Avoid checking ipc_message_info pointer since it is checked in readloop
authorPaul Kocialkowski <contact@paulk.fr>
Sun, 31 Mar 2013 20:46:24 +0000 (22:46 +0200)
committerPaul Kocialkowski <contact@paulk.fr>
Sun, 31 Mar 2013 20:48:21 +0000 (22:48 +0200)
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
12 files changed:
call.c
disp.c
gen.c
gprs.c
misc.c
net.c
pwr.c
rfs.c
sat.c
sec.c
sms.c
ss.c

diff --git a/call.c b/call.c
index 6b34eac..63c8d12 100644 (file)
--- a/call.c
+++ b/call.c
@@ -84,7 +84,7 @@ void ipc_call_status(struct ipc_message_info *info)
 {
        struct ipc_call_status *call_status;
 
-       if (info == NULL || info->data == NULL || info->length < sizeof(struct ipc_call_status))
+       if (info->data == NULL || info->length < sizeof(struct ipc_call_status))
                return;
 
        call_status = (struct ipc_call_status *) info->data;
@@ -141,7 +141,7 @@ void ipc_call_list(struct ipc_message_info *info)
        RIL_Call **current_calls = NULL;
        int i;
 
-       if (info == NULL || info->data == NULL || info->length < sizeof(unsigned char))
+       if (info->data == NULL || info->length < sizeof(unsigned char))
                goto error;
 
        if (info->type != IPC_TYPE_RESP)
@@ -206,7 +206,7 @@ error:
                free(current_calls);
        }
 
-       if (info != NULL && info->type == IPC_TYPE_RESP)
+       if (info->type == IPC_TYPE_RESP)
                ril_request_complete(ril_request_get_token(info->aseq), RIL_E_GENERIC_FAILURE, NULL, 0);
 }
 
@@ -299,7 +299,7 @@ void ipc_call_burst_dtmf(struct ipc_message_info *info)
 {
        unsigned char code;
 
-       if (info == NULL || info->data == NULL || info->length < sizeof(unsigned char))
+       if (info->data == NULL || info->length < sizeof(unsigned char))
                goto error;
 
        code = *((unsigned char *) info->data);
diff --git a/disp.c b/disp.c
index 7ef02ab..3e46b54 100644 (file)
--- a/disp.c
+++ b/disp.c
@@ -110,7 +110,7 @@ void ipc_disp_icon_info(struct ipc_message_info *info)
        RIL_SignalStrength ss;
 #endif
 
-       if (info == NULL || info->data == NULL || info->length < sizeof(struct ipc_disp_icon_info))
+       if (info->data == NULL || info->length < sizeof(struct ipc_disp_icon_info))
                goto error;
 
        icon_info = (struct ipc_disp_icon_info *) info->data;
@@ -131,7 +131,7 @@ void ipc_disp_icon_info(struct ipc_message_info *info)
        return;
 
 error:
-       if (info != NULL && info->type == IPC_TYPE_RESP)
+       if (info->type == IPC_TYPE_RESP)
                ril_request_complete(ril_request_get_token(info->aseq), RIL_E_GENERIC_FAILURE, NULL, 0);
 }
 
@@ -145,7 +145,7 @@ void ipc_disp_rssi_info(struct ipc_message_info *info)
 #endif
        int rssi;
 
-       if (info == NULL || info->data == NULL || info->length < sizeof(struct ipc_disp_rssi_info))
+       if (info->data == NULL || info->length < sizeof(struct ipc_disp_rssi_info))
                return;
 
        rssi_info = (struct ipc_disp_rssi_info *) info->data;
diff --git a/gen.c b/gen.c
index 1c56837..9d64f9a 100644 (file)
--- a/gen.c
+++ b/gen.c
@@ -152,7 +152,7 @@ void ipc_gen_phone_res(struct ipc_message_info *info)
        RIL_Errno e;
        int rc;
 
-       if (info == NULL || info->data == NULL || info->length < sizeof(struct ipc_gen_phone_res))
+       if (info->data == NULL || info->length < sizeof(struct ipc_gen_phone_res))
                return;
 
        phone_res = (struct ipc_gen_phone_res *) info->data;
diff --git a/gprs.c b/gprs.c
index 039a859..37424f8 100644 (file)
--- a/gprs.c
+++ b/gprs.c
@@ -446,7 +446,7 @@ void ipc_gprs_ip_configuration(struct ipc_message_info *info)
        struct ril_gprs_connection *gprs_connection;
        struct ipc_gprs_ip_configuration *ip_configuration;
 
-       if (info == NULL || info->data == NULL || info->length < sizeof(struct ipc_gprs_ip_configuration))
+       if (info->data == NULL || info->length < sizeof(struct ipc_gprs_ip_configuration))
                goto error;
 
        ip_configuration = (struct ipc_gprs_ip_configuration *) info->data;
@@ -472,8 +472,7 @@ void ipc_gprs_ip_configuration(struct ipc_message_info *info)
        return;
 
 error:
-       if (info != NULL)
-               ril_request_complete(ril_request_get_token(info->aseq), RIL_E_GENERIC_FAILURE, NULL, 0);
+       ril_request_complete(ril_request_get_token(info->aseq), RIL_E_GENERIC_FAILURE, NULL, 0);
 }
 
 void ipc_gprs_pdp_context_disable_complete(struct ipc_message_info *info)
@@ -786,7 +785,7 @@ void ipc_gprs_call_status(struct ipc_message_info *info)
 
        int rc;
 
-       if (info == NULL || info->data == NULL || info->length < sizeof(struct ipc_gprs_call_status))
+       if (info->data == NULL || info->length < sizeof(struct ipc_gprs_call_status))
                goto error;
 
        call_status = (struct ipc_gprs_call_status *) info->data;
@@ -918,8 +917,7 @@ void ipc_gprs_call_status(struct ipc_message_info *info)
        return;
 
 error:
-       if (info != NULL)
-               ril_request_complete(ril_request_get_token(info->aseq), RIL_E_GENERIC_FAILURE, NULL, 0);
+       ril_request_complete(ril_request_get_token(info->aseq), RIL_E_GENERIC_FAILURE, NULL, 0);
 }
 
 void ril_request_last_data_call_fail_cause(RIL_Token t)
@@ -1006,7 +1004,7 @@ void ipc_gprs_pdp_context(struct ipc_message_info *info)
 
        int i;
 
-       if (info == NULL || info->data == NULL || info->length < sizeof(struct ipc_gprs_pdp_context_get))
+       if (info->data == NULL || info->length < sizeof(struct ipc_gprs_pdp_context_get))
                goto error;
 
        context = (struct ipc_gprs_pdp_context_get *) info->data;
@@ -1080,8 +1078,7 @@ void ipc_gprs_pdp_context(struct ipc_message_info *info)
        return;
 
 error:
-       if (info != NULL)
-               ril_request_complete(ril_request_get_token(info->aseq), RIL_E_GENERIC_FAILURE, NULL, 0);
+       ril_request_complete(ril_request_get_token(info->aseq), RIL_E_GENERIC_FAILURE, NULL, 0);
 }
 
 void ril_unsol_data_call_list_changed(void)
diff --git a/misc.c b/misc.c
index aa5c87b..95128b5 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -86,7 +86,7 @@ void ipc_misc_me_sn_imei(struct ipc_message_info *info)
        char imei[33];
        char imeisv[3];
 
-       if (info == NULL || info->data == NULL || info->length < sizeof(struct ipc_misc_me_sn))
+       if (info->data == NULL || info->length < sizeof(struct ipc_misc_me_sn))
                goto error;
 
        imei_info = (struct ipc_misc_me_sn *) info->data;
@@ -129,7 +129,7 @@ void ipc_misc_me_sn_imei(struct ipc_message_info *info)
        return;
 
 error:
-       if (info != NULL && info->type == IPC_TYPE_RESP)
+       if (info->type == IPC_TYPE_RESP)
                ril_request_complete(ril_request_get_token(info->aseq), RIL_E_GENERIC_FAILURE, NULL, 0);
 }
 
@@ -137,7 +137,7 @@ void ipc_misc_me_sn(struct ipc_message_info *info)
 {
        struct ipc_misc_me_sn *me_sn_info;
 
-       if (info == NULL || info->data == NULL || info->length < sizeof(struct ipc_misc_me_sn))
+       if (info->data == NULL || info->length < sizeof(struct ipc_misc_me_sn))
                goto error;
 
        if (info->type != IPC_TYPE_RESP)
@@ -158,7 +158,7 @@ void ipc_misc_me_sn(struct ipc_message_info *info)
        return;
 
 error:
-       if (info != NULL && info->type == IPC_TYPE_RESP)
+       if (info->type == IPC_TYPE_RESP)
                ril_request_complete(ril_request_get_token(info->aseq), RIL_E_GENERIC_FAILURE, NULL, 0);
 }
 
@@ -188,7 +188,7 @@ void ipc_misc_me_version(struct ipc_message_info *info)
        struct ipc_misc_me_version *version;
        RIL_Token t;
 
-       if (info == NULL || info->data == NULL || info->length < sizeof(struct ipc_misc_me_version))
+       if (info->data == NULL || info->length < sizeof(struct ipc_misc_me_version))
                goto error;
 
        if (info->type != IPC_TYPE_RESP)
@@ -210,7 +210,7 @@ void ipc_misc_me_version(struct ipc_message_info *info)
        return;
 
 error:
-       if (info != NULL && info->type == IPC_TYPE_RESP)
+       if (info->type == IPC_TYPE_RESP)
                ril_request_complete(ril_request_get_token(info->aseq), RIL_E_GENERIC_FAILURE, NULL, 0);
 }
 
@@ -224,7 +224,7 @@ void ipc_misc_me_imsi(struct ipc_message_info *info)
        unsigned char imsi_length;
        char *imsi;
 
-       if (info == NULL || info->data == NULL || info->length < sizeof(unsigned char))
+       if (info->data == NULL || info->length < sizeof(unsigned char))
                goto error;
 
        /* Don't consider this if modem isn't in normal power mode. */
@@ -251,7 +251,7 @@ void ipc_misc_me_imsi(struct ipc_message_info *info)
        return;
 
 error:
-       if (info != NULL && info->type == IPC_TYPE_RESP)
+       if (info->type == IPC_TYPE_RESP)
                ril_request_complete(ril_request_get_token(info->aseq), RIL_E_GENERIC_FAILURE, NULL, 0);
 }
 
@@ -260,7 +260,7 @@ void ipc_misc_time_info(struct ipc_message_info *info)
        struct ipc_misc_time_info *nitz;
        char str[128];
 
-       if (info == NULL || info->data == NULL || info->length < sizeof(struct ipc_misc_time_info))
+       if (info->data == NULL || info->length < sizeof(struct ipc_misc_time_info))
                return;
 
        nitz = (struct ipc_misc_time_info *) info->data;
diff --git a/net.c b/net.c
index 094819a..cb4774a 100644 (file)
--- a/net.c
+++ b/net.c
@@ -355,7 +355,7 @@ void ipc_net_current_plmn(struct ipc_message_info *info)
        char *response[3];
        size_t i;
 
-       if (info == NULL || info->data == NULL || info->length < sizeof(struct ipc_net_current_plmn_response))
+       if (info->data == NULL || info->length < sizeof(struct ipc_net_current_plmn_response))
                goto error;
 
        plmndata = (struct ipc_net_current_plmn_response *) info->data;
@@ -546,7 +546,7 @@ void ipc_net_regist_unsol(struct ipc_message_info *info)
 {
        struct ipc_net_regist_response *netinfo;
 
-       if (info == NULL || info->data == NULL || info->length < sizeof(struct ipc_net_regist_response))
+       if (info->data == NULL || info->length < sizeof(struct ipc_net_regist_response))
                goto error;
 
        netinfo = (struct ipc_net_regist_response *) info->data;
@@ -617,7 +617,7 @@ void ipc_net_regist_sol(struct ipc_message_info *info)
        char *response[4];
        size_t i;
 
-       if (info == NULL || info->data == NULL || info->length < sizeof(struct ipc_net_regist_response))
+       if (info->data == NULL || info->length < sizeof(struct ipc_net_regist_response))
                goto error;
 
        netinfo = (struct ipc_net_regist_response *) info->data;
@@ -717,7 +717,7 @@ void ipc_net_plmn_list(struct ipc_message_info *info)
        int index;
        int i;
 
-       if (info == NULL || info->data == NULL || info->length < sizeof(struct ipc_net_plmn_entries))
+       if (info->data == NULL || info->length < sizeof(struct ipc_net_plmn_entries))
                goto error;
 
        entries_info = (struct ipc_net_plmn_entries *) info->data;
@@ -768,8 +768,7 @@ void ipc_net_plmn_list(struct ipc_message_info *info)
        return;
 
 error:
-       if (info != NULL)
-               ril_request_complete(ril_request_get_token(info->aseq), RIL_E_GENERIC_FAILURE, NULL, 0);
+       ril_request_complete(ril_request_get_token(info->aseq), RIL_E_GENERIC_FAILURE, NULL, 0);
 }
 
 void ril_request_get_preferred_network_type(RIL_Token t)
@@ -804,7 +803,7 @@ void ipc_net_mode_sel(struct ipc_message_info *info)
        struct ipc_net_mode_sel *mode_sel;
        int ril_mode;
 
-       if (info == NULL || info->data == NULL || info->length < sizeof(struct ipc_net_mode_sel))
+       if (info->data == NULL || info->length < sizeof(struct ipc_net_mode_sel))
                goto error;
 
        mode_sel = (struct ipc_net_mode_sel *) info->data;
@@ -829,7 +828,7 @@ void ipc_net_plmn_sel(struct ipc_message_info *info)
        struct ipc_net_plmn_sel_get *plmn_sel;
        int ril_mode;
 
-       if (info == NULL || info->data == NULL || info->length < sizeof(struct ipc_net_plmn_sel_get))
+       if (info->data == NULL || info->length < sizeof(struct ipc_net_plmn_sel_get))
                goto error;
 
        plmn_sel = (struct ipc_net_plmn_sel_get *) info->data;
@@ -840,8 +839,7 @@ void ipc_net_plmn_sel(struct ipc_message_info *info)
        return;
 
 error:
-       if (info != NULL)
-               ril_request_complete(ril_request_get_token(info->aseq), RIL_E_GENERIC_FAILURE, NULL, 0);
+       ril_request_complete(ril_request_get_token(info->aseq), RIL_E_GENERIC_FAILURE, NULL, 0);
 }
 
 void ipc_net_plmn_sel_complete(struct ipc_message_info *info)
diff --git a/pwr.c b/pwr.c
index d2f0f1c..b04ec0f 100644 (file)
--- a/pwr.c
+++ b/pwr.c
@@ -49,7 +49,7 @@ void ipc_pwr_phone_state(struct ipc_message_info *info)
 {
        unsigned char state;
 
-       if (info == NULL || info->data == NULL || info->length < sizeof(unsigned char))
+       if (info->data == NULL || info->length < sizeof(unsigned char))
                return;
 
        state = *((unsigned char *) info->data);
diff --git a/rfs.c b/rfs.c
index 5234e73..9256926 100644 (file)
--- a/rfs.c
+++ b/rfs.c
@@ -35,7 +35,7 @@ void ipc_rfs_nv_read_item(struct ipc_message_info *info)
        void *rfs_data;
        int rc;
 
-       if (info == NULL || info->data == NULL || info->length < sizeof(struct ipc_rfs_io))
+       if (info->data == NULL || info->length < sizeof(struct ipc_rfs_io))
                return;
 
        rfs_io = (struct ipc_rfs_io *) info->data;
@@ -80,7 +80,7 @@ void ipc_rfs_nv_write_item(struct ipc_message_info *info)
        void *rfs_data;
        int rc;
 
-       if (info == NULL || info->data == NULL || info->length < sizeof(struct ipc_rfs_io))
+       if (info->data == NULL || info->length < sizeof(struct ipc_rfs_io))
                return;
 
        rfs_io = (struct ipc_rfs_io *) info->data;
diff --git a/sat.c b/sat.c
index 7398e1a..29f480b 100644 (file)
--- a/sat.c
+++ b/sat.c
@@ -39,7 +39,7 @@ void ipc_sat_proactive_cmd_unsol(struct ipc_message_info *info)
        char *hexdata;
        int length;
 
-       if (info == NULL || info->data == NULL || info->length < 2)
+       if (info->data == NULL || info->length < 2)
                return;
 
        length = (info->length - 2);
@@ -56,7 +56,7 @@ void ipc_sat_proactive_cmd_sol(struct ipc_message_info *info)
 {
        unsigned char sw1, sw2;
 
-       if (info == NULL || info->data == NULL || info->length < 2 * sizeof(unsigned char))
+       if (info->data == NULL || info->length < 2 * sizeof(unsigned char))
                goto error;
 
        sw1 = ((unsigned char*) info->data)[0];
@@ -147,7 +147,7 @@ void ipc_sat_envelope_cmd(struct ipc_message_info *info)
        char *hexdata;
        int size;
 
-       if (info == NULL || info->data == NULL || info->length < 2)
+       if (info->data == NULL || info->length < 2)
                goto error;
 
        size = (info->length - 2);
@@ -162,7 +162,6 @@ void ipc_sat_envelope_cmd(struct ipc_message_info *info)
        return;
 
 error:
-       if (info != NULL)
-               ril_request_complete(ril_request_get_token(info->aseq), RIL_E_GENERIC_FAILURE, NULL, 0);
+       ril_request_complete(ril_request_get_token(info->aseq), RIL_E_GENERIC_FAILURE, NULL, 0);
 }
 
diff --git a/sec.c b/sec.c
index 390d1d7..c23312c 100644 (file)
--- a/sec.c
+++ b/sec.c
@@ -214,7 +214,7 @@ void ipc_sec_sim_status(struct ipc_message_info *info)
 #endif
        ril_sim_state sim_state;
 
-       if (info == NULL || info->data == NULL || info->length < sizeof(struct ipc_sec_sim_status_response))
+       if (info->data == NULL || info->length < sizeof(struct ipc_sec_sim_status_response))
                goto error;
 
        pin_status = (struct ipc_sec_sim_status_response *) info->data;
@@ -315,7 +315,7 @@ void ipc_sec_sim_icc_type(struct ipc_message_info *info)
 {
        struct ipc_sec_sim_icc_type *sim_icc_type;
 
-       if (info == NULL || info->data == NULL || info->length < sizeof(struct ipc_sec_sim_icc_type))
+       if (info->data == NULL || info->length < sizeof(struct ipc_sec_sim_icc_type))
                goto error;
 
        sim_icc_type = (struct ipc_sec_sim_icc_type *) info->data;
@@ -576,7 +576,7 @@ void ipc_sec_rsim_access(struct ipc_message_info *info)
        int offset;
        int i;
 
-       if (info == NULL || info->data == NULL || info->length < sizeof(struct ipc_sec_rsim_access_response))
+       if (info->data == NULL || info->length < sizeof(struct ipc_sec_rsim_access_response))
                goto error;
 
        sim_io_info = ril_request_sim_io_info_find_token(ril_request_get_token(info->aseq));
@@ -704,8 +704,7 @@ void ipc_sec_rsim_access(struct ipc_message_info *info)
        return;
 
 error:
-       if (info != NULL)
-               ril_request_complete(ril_request_get_token(info->aseq), RIL_E_GENERIC_FAILURE, NULL, 0);
+       ril_request_complete(ril_request_get_token(info->aseq), RIL_E_GENERIC_FAILURE, NULL, 0);
 }
 
 void ipc_sec_sim_status_complete(struct ipc_message_info *info)
@@ -743,7 +742,7 @@ void ipc_sec_lock_info(struct ipc_message_info *info)
        struct ipc_sec_lock_info_response *lock_info;
        int attempts;
 
-       if (info == NULL || info->data == NULL || info->length < sizeof(struct ipc_sec_lock_info_response))
+       if (info->data == NULL || info->length < sizeof(struct ipc_sec_lock_info_response))
                return;
 
        lock_info = (struct ipc_sec_lock_info_response *) info->data;
@@ -865,7 +864,7 @@ void ipc_sec_phone_lock(struct ipc_message_info *info)
        int status;
        struct ipc_sec_phone_lock_response *lock;
 
-       if (info == NULL || info->data == NULL || info->length < sizeof(struct ipc_sec_phone_lock_response))
+       if (info->data == NULL || info->length < sizeof(struct ipc_sec_phone_lock_response))
                goto error;
 
        lock = (struct ipc_sec_phone_lock_response *) info->data;
@@ -876,8 +875,7 @@ void ipc_sec_phone_lock(struct ipc_message_info *info)
        return;
 
 error:
-       if (info != NULL)
-               ril_request_complete(ril_request_get_token(info->aseq), RIL_E_GENERIC_FAILURE, NULL, 0);
+       ril_request_complete(ril_request_get_token(info->aseq), RIL_E_GENERIC_FAILURE, NULL, 0);
 }
 
 void ril_request_query_facility_lock(RIL_Token t, void *data, size_t length)
diff --git a/sms.c b/sms.c
index d13edcb..1369fc8 100644 (file)
--- a/sms.c
+++ b/sms.c
@@ -421,7 +421,7 @@ void ipc_sms_svc_center_addr(struct ipc_message_info *info)
        int smsc_length;
        int rc;
 
-       if (info == NULL || info->data == NULL || info->length < sizeof(unsigned char))
+       if (info->data == NULL || info->length < sizeof(unsigned char))
                goto error;
 
        send_sms = ril_request_send_sms_info_find_token(ril_request_get_token(info->aseq));
@@ -452,8 +452,7 @@ void ipc_sms_svc_center_addr(struct ipc_message_info *info)
        return;
 
 error:
-       if (info != NULL)
-               ril_request_complete(ril_request_get_token(info->aseq), RIL_E_GENERIC_FAILURE, NULL, 0);
+       ril_request_complete(ril_request_get_token(info->aseq), RIL_E_GENERIC_FAILURE, NULL, 0);
 }
 
 void ipc_sms_send_msg_complete(struct ipc_message_info *info)
@@ -477,7 +476,7 @@ void ipc_sms_send_msg(struct ipc_message_info *info)
        RIL_SMS_Response response;
        RIL_Errno e;
 
-       if (info == NULL || info->data == NULL || info->length < sizeof(struct ipc_sms_send_msg_response))
+       if (info->data == NULL || info->length < sizeof(struct ipc_sms_send_msg_response))
                goto error;
 
        report_msg = (struct ipc_sms_send_msg_response *) info->data;
@@ -498,8 +497,7 @@ void ipc_sms_send_msg(struct ipc_message_info *info)
        return;
 
 error:
-       if (info != NULL)
-               ril_request_complete(ril_request_get_token(info->aseq), RIL_E_GENERIC_FAILURE, NULL, 0);
+       ril_request_complete(ril_request_get_token(info->aseq), RIL_E_GENERIC_FAILURE, NULL, 0);
 }
 
 /*
@@ -618,7 +616,7 @@ void ipc_sms_incoming_msg(struct ipc_message_info *info)
        int length;
        int rc;
 
-       if (info == NULL || info->data == NULL || info->length < sizeof(struct ipc_sms_incoming_msg))
+       if (info->data == NULL || info->length < sizeof(struct ipc_sms_incoming_msg))
                goto error;
 
        msg = (struct ipc_sms_incoming_msg *) info->data;
@@ -688,7 +686,7 @@ void ipc_sms_deliver_report(struct ipc_message_info *info)
        RIL_Errno e;
        int error_code;
 
-       if (info == NULL || info->data == NULL || info->length < sizeof(struct ipc_sms_deliver_report_response))
+       if (info->data == NULL || info->length < sizeof(struct ipc_sms_deliver_report_response))
                goto error;
 
        report_msg = (struct ipc_sms_deliver_report_response *) info->data;
diff --git a/ss.c b/ss.c
index 404dd37..a2483fa 100644 (file)
--- a/ss.c
+++ b/ss.c
@@ -189,7 +189,7 @@ void ipc_ss_ussd(struct ipc_message_info *info)
        struct ipc_ss_ussd *ussd = NULL;
        unsigned char state;
 
-       if (info == NULL || info->data == NULL || info->length < sizeof(struct ipc_ss_ussd))
+       if (info->data == NULL || info->length < sizeof(struct ipc_ss_ussd))
                goto error;
 
        memset(message, 0, sizeof(message));
@@ -242,6 +242,5 @@ void ipc_ss_ussd(struct ipc_message_info *info)
        return;
 
 error:
-       if (info != NULL)
-               ril_request_complete(ril_request_get_token(info->aseq), RIL_E_GENERIC_FAILURE, NULL, 0);
+       ril_request_complete(ril_request_get_token(info->aseq), RIL_E_GENERIC_FAILURE, NULL, 0);
 }