Hi Yang,

> +     if (__ofono_call_barring_is_busy(cb))
> +             return EBUSY;

Please use negative errno values, e.g. return -EBUSY, etc.

>       if (strlen(sic) > 0)
> -             goto bad_format;
> +             return EINVAL;

here

>  
>       if (strlen(dn) > 0)
> -             goto bad_format;
> +             return EINVAL;

and here

>  
>       if (type != SS_CONTROL_TYPE_QUERY && !is_valid_pin(sia, PIN_TYPE_NET))
> -             goto bad_format;
> +             return EINVAL;
>  

and here

> +     if (!operation)
> +             return ENOSYS;

And here, etc..

> diff --git a/src/ussd.c b/src/ussd.c
> index bbb9aed..6119573 100644
> --- a/src/ussd.c
> +++ b/src/ussd.c
> @@ -205,32 +205,29 @@ static gboolean recognized_passwd_change_string(struct 
> ofono_ussd *ussd,
>               break;
>  
>       default:
> -             return FALSE;
> +             return -ENOENT;
>       }
>  
>       if (strcmp(sc, "03") || strlen(dn))
> -             return FALSE;
> +             return -ENOENT;
>  
>       /* If SIC & SID don't match, then we just bail out here */
> -     if (strcmp(sic, sid)) {
> -             DBusConnection *conn = ofono_dbus_get_connection();
> -             DBusMessage *reply = __ofono_error_invalid_format(msg);
> -             g_dbus_send_message(conn, reply);
> -             return TRUE;
> -     }
> +     if (strcmp(sic, sid))
> +             return EINVAL;
>  
>       while ((l = g_slist_find_custom(l, sia,
>                       ssc_entry_find_by_service)) != NULL) {
>               struct ssc_entry *entry = l->data;
>               ofono_ussd_passwd_cb_t cb = entry->cb;
> +             int result = cb(sia, sib, sic, msg, entry->user);
>  
> -             if (cb(sia, sib, sic, msg, entry->user))
> -                     return TRUE;
> +             if (result >= 0)
> +                     return result;

I suggest simply checking for -ENOENT here.

Regards,
-Denis
_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono

Reply via email to