Hi Jeevaka,

>  drivers/ifxmodem/radio-settings.c |   15 ++++++++++-----
>  1 files changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/ifxmodem/radio-settings.c 
> b/drivers/ifxmodem/radio-settings.c
> index fd590ae..6771e00 100644
> --- a/drivers/ifxmodem/radio-settings.c
> +++ b/drivers/ifxmodem/radio-settings.c
> @@ -104,11 +104,13 @@ static void ifx_query_rat_mode(struct 
> ofono_radio_settings *rs,
>       struct radio_settings_data *rsd = ofono_radio_settings_get_data(rs);
>       struct cb_data *cbd = cb_data_new(cb, data);
>  
> -     if (g_at_chat_send(rsd->chat, "AT+XRAT?", xrat_prefix,
> -                                     xrat_query_cb, cbd, g_free) == 0) {
> -             CALLBACK_WITH_FAILURE(cb, -1, data);
> -             g_free(cbd);
> -     }
> +     if (cbd && g_at_chat_send(rsd->chat, "AT+XRAT?", xrat_prefix,
> +                                     xrat_query_cb, cbd, g_free) > 0)
> +             return;

I don't like these constructs. They quickly make the code unreadable and
really complex. Using a

        if (cbd == NULL)
                goto failure;

would be a lot cleaner.

It might be just better to make cb_data_new use g_new0 instead of
g_try_new0 and remove all checks for cb_data.

Regards

Marcel


_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono

Reply via email to