Hi Martin,

On 04/26/2011 04:07 AM, [email protected] wrote:
> From: Martin Xu <[email protected]>
> 
> disable gprs function if open modem device file failed, Otherwise, it
> will cause ofonod crash, due to gatchat is NULL.
> ---
>  plugins/huawei.c |   10 ++++++----
>  1 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/plugins/huawei.c b/plugins/huawei.c
> index 4051a93..1f69a8c 100644
> --- a/plugins/huawei.c
> +++ b/plugins/huawei.c
> @@ -475,9 +475,10 @@ static void huawei_disconnect(gpointer user_data)
>       data->modem = NULL;
>  
>       data->modem = open_device(modem, "Modem", "Modem: ");
> -     if (data->modem == NULL)
> +     if (data->modem == NULL) {
> +             ofono_error("open device failed!");
>               return;
> -
> +     }
>       g_at_chat_set_disconnect_function(data->modem,
>                                               huawei_disconnect, modem);
>  

I dropped this chunk from the patch, I didn't think it was adding
anything useful.

> @@ -681,8 +682,9 @@ static void huawei_post_online(struct ofono_modem *modem)
>       ofono_ussd_create(modem, OFONO_VENDOR_QUALCOMM_MSM,
>                                               "atmodem", data->pcui);
>  
> -     if (data->sim_state == HUAWEI_SIM_STATE_VALID ||
> -                     data->sim_state == HUAWEI_SIM_STATE_INVALID_CS) {
> +     if ((data->sim_state == HUAWEI_SIM_STATE_VALID ||
> +                     data->sim_state == HUAWEI_SIM_STATE_INVALID_CS) &&
> +                     data->modem != NULL) {
>               data->gprs = ofono_gprs_create(modem, OFONO_VENDOR_HUAWEI,
>                                               "atmodem", data->pcui);
>  

This chunk has been applied with a slightly reworded commit message.
Thanks for that.

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

Reply via email to