All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] Check modem device open failure
@ 2011-04-26  9:07 martin.xu
  2011-04-26 19:53 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: martin.xu @ 2011-04-26  9:07 UTC (permalink / raw)
  To: ofono

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

From: Martin Xu <martin.xu@intel.com>

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);
 
@@ -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);
 
-- 
1.7.2.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/2] Check modem device open failure
  2011-04-26  9:07 [PATCH 2/2] Check modem device open failure martin.xu
@ 2011-04-26 19:53 ` Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2011-04-26 19:53 UTC (permalink / raw)
  To: ofono

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

Hi Martin,

On 04/26/2011 04:07 AM, martin.xu(a)intel.com wrote:
> From: Martin Xu <martin.xu@intel.com>
> 
> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-04-26 19:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-26  9:07 [PATCH 2/2] Check modem device open failure martin.xu
2011-04-26 19:53 ` Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.