From fd051580b347b09bf43d1fab29cea3d58b113e09 Mon Sep 17 00:00:00 2001 From: Paul Kocialkowski Date: Sat, 28 Sep 2013 16:38:51 +0200 Subject: Check modem state before RIL requests and properly report it on crash Signed-off-by: Paul Kocialkowski --- ipc.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'ipc.c') diff --git a/ipc.c b/ipc.c index 24df4b8..c7d3513 100644 --- a/ipc.c +++ b/ipc.c @@ -66,7 +66,7 @@ int ipc_fmt_read_loop(struct ril_client *client) rc = ipc_client_poll(ipc_client, NULL); if (rc < 0) { LOGE("IPC FMT client poll failed, aborting"); - return -1; + goto error; } memset(&info, 0, sizeof(info)); @@ -75,7 +75,7 @@ int ipc_fmt_read_loop(struct ril_client *client) if (ipc_client_recv(ipc_client, &info) < 0) { RIL_CLIENT_UNLOCK(client); LOGE("IPC FMT recv failed, aborting"); - return -1; + goto error; } RIL_CLIENT_UNLOCK(client); @@ -84,7 +84,16 @@ int ipc_fmt_read_loop(struct ril_client *client) ipc_client_response_free(ipc_client, &info); } - return 0; + rc = 0; + goto complete; + +error: + ril_radio_state_update(RADIO_STATE_UNAVAILABLE); + + rc = -1; + +complete: + return rc; } int ipc_fmt_create(struct ril_client *client) @@ -232,7 +241,7 @@ int ipc_rfs_read_loop(struct ril_client *client) rc = ipc_client_poll(ipc_client, NULL); if (rc < 0) { LOGE("IPC RFS client poll failed, aborting"); - return -1; + goto error; } memset(&info, 0, sizeof(info)); @@ -241,7 +250,7 @@ int ipc_rfs_read_loop(struct ril_client *client) if (ipc_client_recv(ipc_client, &info) < 0) { RIL_CLIENT_UNLOCK(client); LOGE("IPC RFS recv failed, aborting"); - return -1; + goto error; } RIL_CLIENT_UNLOCK(client); @@ -250,7 +259,16 @@ int ipc_rfs_read_loop(struct ril_client *client) ipc_client_response_free(ipc_client, &info); } - return 0; + rc = 0; + goto complete; + +error: + ril_radio_state_update(RADIO_STATE_UNAVAILABLE); + + rc = -1; + +complete: + return rc; } int ipc_rfs_create(struct ril_client *client) -- cgit v1.1