Open Source Telephony
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH 4/5] ss: Use errno for ssc handling functions
Date: Sun, 26 Sep 2010 20:01:54 -0500	[thread overview]
Message-ID: <4C9FED02.2040006@gmail.com> (raw)
In-Reply-To: <1285064479-12907-5-git-send-email-yang.gu@intel.com>

[-- Attachment #1: Type: text/plain, Size: 1648 bytes --]

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

  reply	other threads:[~2010-09-27  1:01 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-21 10:21 [PATCH 0/5] Patch Description Yang Gu
2010-09-21 10:21 ` [PATCH 1/5] Add macro for general result and additional info Yang Gu
2010-09-27  0:47   ` Denis Kenzior
2010-09-21 10:21 ` [PATCH 2/5] stk: Support send ss response Yang Gu
2010-09-27  0:48   ` Denis Kenzior
2010-10-18  8:04     ` Gu, Yang
2010-10-18 17:30       ` andrzej zaborowski
2010-10-18 22:34         ` Denis Kenzior
2010-09-21 10:21 ` [PATCH 3/5] ss: Use function to judge if it's busy Yang Gu
2010-09-27  1:05   ` Denis Kenzior
2010-09-21 10:21 ` [PATCH 4/5] ss: Use errno for ssc handling functions Yang Gu
2010-09-27  1:01   ` Denis Kenzior [this message]
2010-09-21 10:21 ` [PATCH 5/5] cf: Handle send ss proactive command Yang Gu
2010-09-21 19:28   ` Jeevaka.Badrappan
2010-09-27  2:11     ` Gu, Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C9FED02.2040006@gmail.com \
    --to=denkenz@gmail.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox