mirror of git://git.sysmocom.de/ofono
drivers: explicitly compare pointers to NULL
This patch was generated by the following semantic patch (http://coccinelle.lip6.fr/) // <smpl> @fix disable is_null,isnt_null1@ expression *E; @@ - !E + E == NULL // </smpl>
This commit is contained in:
parent
43d2435e64
commit
b82a7f8511
|
@ -133,8 +133,7 @@ GSList *at_util_parse_clcc(GAtResult *result)
|
|||
g_at_result_iter_next_number(&iter, &number_type);
|
||||
|
||||
call = g_try_new0(struct ofono_call, 1);
|
||||
|
||||
if (!call)
|
||||
if (call == NULL)
|
||||
break;
|
||||
|
||||
call->id = id;
|
||||
|
|
|
@ -82,8 +82,7 @@ static inline struct cb_data *cb_data_new(void *cb, void *data)
|
|||
struct cb_data *ret;
|
||||
|
||||
ret = g_try_new0(struct cb_data, 1);
|
||||
|
||||
if (!ret)
|
||||
if (ret == NULL)
|
||||
return ret;
|
||||
|
||||
ret->cb = cb;
|
||||
|
|
|
@ -86,7 +86,7 @@ static void at_call_barring_query(struct ofono_call_barring *cb,
|
|||
struct cb_data *cbd = cb_data_new(callback, data);
|
||||
char buf[64];
|
||||
|
||||
if (!cbd || strlen(lock) != 2)
|
||||
if (cbd == NULL || strlen(lock) != 2)
|
||||
goto error;
|
||||
|
||||
snprintf(buf, sizeof(buf), "AT+CLCK=\"%s\",2", lock);
|
||||
|
@ -121,7 +121,7 @@ static void at_call_barring_set(struct ofono_call_barring *cb, const char *lock,
|
|||
char buf[64];
|
||||
int len;
|
||||
|
||||
if (!cbd || strlen(lock) != 2 || (cls && !passwd))
|
||||
if (cbd == NULL || strlen(lock) != 2 || (cls && passwd == NULL))
|
||||
goto error;
|
||||
|
||||
len = snprintf(buf, sizeof(buf), "AT+CLCK=\"%s\",%i", lock, enable);
|
||||
|
@ -164,7 +164,7 @@ static void at_call_barring_set_passwd(struct ofono_call_barring *cb,
|
|||
struct cb_data *cbd = cb_data_new(callback, data);
|
||||
char buf[64];
|
||||
|
||||
if (!cbd || strlen(lock) != 2)
|
||||
if (cbd == NULL || strlen(lock) != 2)
|
||||
goto error;
|
||||
|
||||
snprintf(buf, sizeof(buf), "AT+CPWD=\"%s\",\"%s\",\"%s\"",
|
||||
|
|
|
@ -128,7 +128,7 @@ static void at_ccfc_query(struct ofono_call_forwarding *cf, int type, int cls,
|
|||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
char buf[64];
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
cbd->user = GINT_TO_POINTER(cls);
|
||||
|
@ -165,7 +165,7 @@ static void at_ccfc_set(struct ofono_call_forwarding *cf, const char *buf,
|
|||
GAtChat *chat = ofono_call_forwarding_get_data(cf);
|
||||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
if (g_at_chat_send(chat, buf, none_prefix,
|
||||
|
|
|
@ -116,7 +116,7 @@ static void at_caoc_query(struct ofono_call_meter *cm,
|
|||
GAtChat *chat = ofono_call_meter_get_data(cm);
|
||||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
cbd->user = "+CAOC:";
|
||||
|
@ -137,7 +137,7 @@ static void at_cacm_query(struct ofono_call_meter *cm,
|
|||
GAtChat *chat = ofono_call_meter_get_data(cm);
|
||||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
cbd->user = "+CACM:";
|
||||
|
@ -169,7 +169,7 @@ static void at_cacm_set(struct ofono_call_meter *cm, const char *passwd,
|
|||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
char buf[64];
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
snprintf(buf, sizeof(buf), "AT+CACM=\"%s\"", passwd);
|
||||
|
@ -191,7 +191,7 @@ static void at_camm_query(struct ofono_call_meter *cm,
|
|||
GAtChat *chat = ofono_call_meter_get_data(cm);
|
||||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
cbd->user = "+CAMM:";
|
||||
|
@ -213,7 +213,7 @@ static void at_camm_set(struct ofono_call_meter *cm,
|
|||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
char buf[64];
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
snprintf(buf, sizeof(buf), "AT+CAMM=\"%06X\",\"%s\"", accmax, passwd);
|
||||
|
@ -274,7 +274,7 @@ static void at_cpuc_query(struct ofono_call_meter *cm,
|
|||
GAtChat *chat = ofono_call_meter_get_data(cm);
|
||||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
cbd->user = "+CPUC:";
|
||||
|
@ -296,7 +296,7 @@ static void at_cpuc_set(struct ofono_call_meter *cm, const char *currency,
|
|||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
char buf[64];
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
snprintf(buf, sizeof(buf), "AT+CPUC=\"%s\",\"%f\",\"%s\"",
|
||||
|
|
|
@ -84,7 +84,7 @@ static void at_ccwa_query(struct ofono_call_settings *cs, int cls,
|
|||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
char buf[64];
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
cbd->user = GINT_TO_POINTER(cls);
|
||||
|
@ -122,7 +122,7 @@ static void at_ccwa_set(struct ofono_call_settings *cs, int mode, int cls,
|
|||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
char buf[64];
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
snprintf(buf, sizeof(buf), "AT+CCWA=1,%d,%d", mode, cls);
|
||||
|
@ -175,7 +175,7 @@ static void at_clip_query(struct ofono_call_settings *cs,
|
|||
GAtChat *chat = ofono_call_settings_get_data(cs);
|
||||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
if (g_at_chat_send(chat, "AT+CLIP?", clip_prefix,
|
||||
|
@ -225,7 +225,7 @@ static void at_colp_query(struct ofono_call_settings *cs,
|
|||
GAtChat *chat = ofono_call_settings_get_data(cs);
|
||||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
if (g_at_chat_send(chat, "AT+COLP?", colp_prefix,
|
||||
|
@ -274,7 +274,7 @@ static void at_clir_query(struct ofono_call_settings *cs,
|
|||
GAtChat *chat = ofono_call_settings_get_data(cs);
|
||||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
if (g_at_chat_send(chat, "AT+CLIR?", clir_prefix,
|
||||
|
@ -305,7 +305,7 @@ static void at_clir_set(struct ofono_call_settings *cs, int mode,
|
|||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
char buf[64];
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
snprintf(buf, sizeof(buf), "AT+CLIR=%d", mode);
|
||||
|
@ -358,7 +358,7 @@ static void at_colr_query(struct ofono_call_settings *cs,
|
|||
GAtChat *chat = ofono_call_settings_get_data(cs);
|
||||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
if (g_at_chat_send(chat, "AT+COLR", colr_prefix,
|
||||
|
|
|
@ -138,7 +138,7 @@ static void at_call_volume_speaker_volume(struct ofono_call_volume *cv,
|
|||
char buf[64];
|
||||
int level;
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
level = ((cvd->clvl_max - cvd->clvl_min) *
|
||||
|
@ -163,7 +163,7 @@ static void at_call_volume_mute(struct ofono_call_volume *cv, int muted,
|
|||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
char buf[64];
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
snprintf(buf, sizeof(buf), "AT+CMUT=%d", muted);
|
||||
|
|
|
@ -74,8 +74,7 @@ static void at_cbm_notify(GAtResult *result, gpointer user_data)
|
|||
}
|
||||
|
||||
hexpdu = g_at_result_pdu(result);
|
||||
|
||||
if (!hexpdu) {
|
||||
if (hexpdu == NULL) {
|
||||
ofono_error("Got a CBM, but no PDU. Are we in text mode?");
|
||||
return;
|
||||
}
|
||||
|
@ -116,7 +115,7 @@ static void at_cbs_set_topics(struct ofono_cbs *cbs, const char *topics,
|
|||
|
||||
DBG("");
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
/* For the Qualcomm based devices it is required to clear
|
||||
|
@ -155,7 +154,7 @@ static void at_cbs_clear_topics(struct ofono_cbs *cbs,
|
|||
|
||||
DBG("");
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
if (data->cscb_mode_1)
|
||||
|
|
|
@ -92,7 +92,7 @@ static void at_query_manufacturer(struct ofono_devinfo *info,
|
|||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
GAtChat *chat = ofono_devinfo_get_data(info);
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
cbd->user = "+CGMI:";
|
||||
|
@ -113,7 +113,7 @@ static void at_query_model(struct ofono_devinfo *info,
|
|||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
GAtChat *chat = ofono_devinfo_get_data(info);
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
cbd->user = "+CGMM:";
|
||||
|
@ -134,7 +134,7 @@ static void at_query_revision(struct ofono_devinfo *info,
|
|||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
GAtChat *chat = ofono_devinfo_get_data(info);
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
cbd->user = "+CGMR:";
|
||||
|
@ -155,7 +155,7 @@ static void at_query_serial(struct ofono_devinfo *info,
|
|||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
GAtChat *chat = ofono_devinfo_get_data(info);
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
cbd->user = "+CGSN:";
|
||||
|
|
|
@ -282,7 +282,7 @@ static int at_gprs_context_probe(struct ofono_gprs_context *gc,
|
|||
}
|
||||
|
||||
gcd = g_try_new0(struct gprs_context_data, 1);
|
||||
if (!gcd)
|
||||
if (gcd == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
gcd->chat = g_at_chat_clone(chat);
|
||||
|
|
|
@ -69,7 +69,7 @@ static void at_gprs_set_attached(struct ofono_gprs *gprs, int attached,
|
|||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
char buf[64];
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
snprintf(buf, sizeof(buf), "AT+CGATT=%i", attached ? 1 : 0);
|
||||
|
@ -115,7 +115,7 @@ static void at_gprs_registration_status(struct ofono_gprs *gprs,
|
|||
struct gprs_data *gd = ofono_gprs_get_data(gprs);
|
||||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
cbd->user = gd;
|
||||
|
@ -350,7 +350,7 @@ static int at_gprs_probe(struct ofono_gprs *gprs,
|
|||
struct gprs_data *gd;
|
||||
|
||||
gd = g_try_new0(struct gprs_data, 1);
|
||||
if (!gd)
|
||||
if (gd == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
gd->chat = g_at_chat_clone(chat);
|
||||
|
|
|
@ -182,7 +182,7 @@ static void at_registration_status(struct ofono_netreg *netreg,
|
|||
struct netreg_data *nd = ofono_netreg_get_data(netreg);
|
||||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
cbd->user = nd;
|
||||
|
@ -349,7 +349,7 @@ static void at_current_operator(struct ofono_netreg *netreg,
|
|||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
gboolean ok;
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
cbd->user = netreg;
|
||||
|
@ -408,8 +408,7 @@ static void cops_list_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
|||
DBG("Got %d elements", num);
|
||||
|
||||
list = g_try_new0(struct ofono_network_operator, num);
|
||||
|
||||
if (!list) {
|
||||
if (list == NULL) {
|
||||
CALLBACK_WITH_FAILURE(cb, 0, NULL, cbd->data);
|
||||
return;
|
||||
}
|
||||
|
@ -492,7 +491,7 @@ static void at_list_operators(struct ofono_netreg *netreg,
|
|||
struct netreg_data *nd = ofono_netreg_get_data(netreg);
|
||||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
if (g_at_chat_send(nd->chat, "AT+COPS=?", cops_prefix,
|
||||
|
@ -522,7 +521,7 @@ static void at_register_auto(struct ofono_netreg *netreg,
|
|||
struct netreg_data *nd = ofono_netreg_get_data(netreg);
|
||||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
if (g_at_chat_send(nd->chat, "AT+COPS=0", none_prefix,
|
||||
|
@ -543,7 +542,7 @@ static void at_register_manual(struct ofono_netreg *netreg,
|
|||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
char buf[128];
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
snprintf(buf, sizeof(buf), "AT+COPS=1,2,\"%s%s\"", mcc, mnc);
|
||||
|
@ -564,7 +563,7 @@ static void at_deregister(struct ofono_netreg *netreg,
|
|||
struct netreg_data *nd = ofono_netreg_get_data(netreg);
|
||||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
if (g_at_chat_send(nd->chat, "AT+COPS=2", none_prefix,
|
||||
|
@ -862,7 +861,7 @@ static void at_signal_strength(struct ofono_netreg *netreg,
|
|||
struct netreg_data *nd = ofono_netreg_get_data(netreg);
|
||||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
cbd->user = nd;
|
||||
|
@ -1045,7 +1044,7 @@ static void creg_notify(GAtResult *result, gpointer user_data)
|
|||
switch (nd->vendor) {
|
||||
case OFONO_VENDOR_OPTION_HSO:
|
||||
tq = g_new0(struct tech_query, 1);
|
||||
if (!tq)
|
||||
if (tq == NULL)
|
||||
break;
|
||||
|
||||
tq->status = status;
|
||||
|
|
|
@ -368,7 +368,7 @@ static void at_export_entries(struct ofono_phonebook *pb, const char *storage,
|
|||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
char buf[32];
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
cbd->user = pb;
|
||||
|
@ -536,7 +536,7 @@ static int at_phonebook_probe(struct ofono_phonebook *pb, unsigned int vendor,
|
|||
struct pb_data *pbd;
|
||||
|
||||
pbd = g_try_new0(struct pb_data, 1);
|
||||
if (!pbd)
|
||||
if (pbd == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
pbd->chat = g_at_chat_clone(chat);
|
||||
|
|
|
@ -246,7 +246,7 @@ void atmodem_poll_enable(struct ofono_modem *modem, GAtChat *chat)
|
|||
sim_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_SIM);
|
||||
stk_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_STK);
|
||||
|
||||
if (!sim_atom)
|
||||
if (sim_atom == NULL)
|
||||
return;
|
||||
|
||||
spd = g_new0(struct sim_poll_data, 1);
|
||||
|
|
|
@ -138,7 +138,7 @@ static void at_sim_read_info(struct ofono_sim *sim, int fileid,
|
|||
}
|
||||
|
||||
cbd = cb_data_new(cb, data);
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
snprintf(buf, sizeof(buf), "AT+CRSM=192,%i", fileid);
|
||||
|
@ -211,7 +211,7 @@ static void at_sim_read_binary(struct ofono_sim *sim, int fileid,
|
|||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
char buf[64];
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
snprintf(buf, sizeof(buf), "AT+CRSM=176,%i,%i,%i,%i", fileid,
|
||||
|
@ -235,7 +235,7 @@ static void at_sim_read_record(struct ofono_sim *sim, int fileid,
|
|||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
char buf[64];
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
snprintf(buf, sizeof(buf), "AT+CRSM=178,%i,%i,4,%i", fileid,
|
||||
|
@ -300,7 +300,7 @@ static void at_sim_update_binary(struct ofono_sim *sim, int fileid,
|
|||
char *buf = g_try_new(char, 36 + length * 2);
|
||||
int len, ret;
|
||||
|
||||
if (!cbd || !buf)
|
||||
if (cbd == NULL || buf == NULL)
|
||||
goto error;
|
||||
|
||||
len = sprintf(buf, "AT+CRSM=214,%i,%i,%i,%i,", fileid,
|
||||
|
@ -333,7 +333,7 @@ static void at_sim_update_record(struct ofono_sim *sim, int fileid,
|
|||
char *buf = g_try_new(char, 36 + length * 2);
|
||||
int len, ret;
|
||||
|
||||
if (!cbd || !buf)
|
||||
if (cbd == NULL || buf == NULL)
|
||||
goto error;
|
||||
|
||||
len = sprintf(buf, "AT+CRSM=220,%i,%i,4,%i,", fileid,
|
||||
|
@ -365,7 +365,7 @@ static void at_sim_update_cyclic(struct ofono_sim *sim, int fileid,
|
|||
char *buf = g_try_new(char, 36 + length * 2);
|
||||
int len, ret;
|
||||
|
||||
if (!cbd || !buf)
|
||||
if (cbd == NULL || buf == NULL)
|
||||
goto error;
|
||||
|
||||
len = sprintf(buf, "AT+CRSM=220,%i,0,3,%i,", fileid, length);
|
||||
|
@ -421,7 +421,7 @@ static void at_read_imsi(struct ofono_sim *sim, ofono_sim_imsi_cb_t cb,
|
|||
struct sim_data *sd = ofono_sim_get_data(sim);
|
||||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
if (g_at_chat_send(sd->chat, "AT+CIMI", NULL,
|
||||
|
@ -517,7 +517,7 @@ static void at_pin_query(struct ofono_sim *sim, ofono_sim_passwd_cb_t cb,
|
|||
struct sim_data *sd = ofono_sim_get_data(sim);
|
||||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
cbd->user = sim;
|
||||
|
@ -626,7 +626,7 @@ static void at_pin_send(struct ofono_sim *sim, const char *passwd,
|
|||
char buf[64];
|
||||
int ret;
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
cbd->user = sd;
|
||||
|
@ -656,7 +656,7 @@ static void at_pin_send_puk(struct ofono_sim *sim, const char *puk,
|
|||
char buf[64];
|
||||
int ret;
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
cbd->user = sd;
|
||||
|
@ -711,10 +711,10 @@ static void at_pin_enable(struct ofono_sim *sim,
|
|||
int ret;
|
||||
unsigned int len = sizeof(at_clck_cpwd_fac) / sizeof(*at_clck_cpwd_fac);
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
if (passwd_type >= len || !at_clck_cpwd_fac[passwd_type])
|
||||
if (passwd_type >= len || at_clck_cpwd_fac[passwd_type] == NULL)
|
||||
goto error;
|
||||
|
||||
snprintf(buf, sizeof(buf), "AT+CLCK=\"%s\",%i,\"%s\"",
|
||||
|
@ -745,11 +745,11 @@ static void at_change_passwd(struct ofono_sim *sim,
|
|||
int ret;
|
||||
unsigned int len = sizeof(at_clck_cpwd_fac) / sizeof(*at_clck_cpwd_fac);
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
if (passwd_type >= len ||
|
||||
!at_clck_cpwd_fac[passwd_type])
|
||||
at_clck_cpwd_fac[passwd_type] == NULL)
|
||||
goto error;
|
||||
|
||||
snprintf(buf, sizeof(buf), "AT+CPWD=\"%s\",\"%s\",\"%s\"",
|
||||
|
@ -808,10 +808,10 @@ static void at_pin_query_enabled(struct ofono_sim *sim,
|
|||
char buf[64];
|
||||
unsigned int len = sizeof(at_clck_cpwd_fac) / sizeof(*at_clck_cpwd_fac);
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
if (passwd_type >= len || !at_clck_cpwd_fac[passwd_type])
|
||||
if (passwd_type >= len || at_clck_cpwd_fac[passwd_type] == NULL)
|
||||
goto error;
|
||||
|
||||
snprintf(buf, sizeof(buf), "AT+CLCK=\"%s\",2",
|
||||
|
|
|
@ -106,7 +106,7 @@ static void at_csca_set(struct ofono_sms *sms,
|
|||
struct cb_data *cbd = cb_data_new(cb, user_data);
|
||||
char buf[64];
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
snprintf(buf, sizeof(buf), "AT+CSCA=\"%s\",%d", sca->number, sca->type);
|
||||
|
@ -173,7 +173,7 @@ static void at_csca_query(struct ofono_sms *sms, ofono_sms_sca_query_cb_t cb,
|
|||
struct sms_data *data = ofono_sms_get_data(sms);
|
||||
struct cb_data *cbd = cb_data_new(cb, user_data);
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
if (g_at_chat_send(data->chat, "AT+CSCA?", csca_prefix,
|
||||
|
@ -227,7 +227,7 @@ static void at_cmgs(struct ofono_sms *sms, unsigned char *pdu, int pdu_len,
|
|||
char buf[512];
|
||||
int len;
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
if (mms) {
|
||||
|
@ -267,7 +267,7 @@ static void at_cgsms_set(struct ofono_sms *sms, int bearer,
|
|||
struct cb_data *cbd = cb_data_new(cb, user_data);
|
||||
char buf[64];
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
snprintf(buf, sizeof(buf), "AT+CGSMS=%d", bearer);
|
||||
|
@ -319,7 +319,7 @@ static void at_cgsms_query(struct ofono_sms *sms,
|
|||
struct sms_data *data = ofono_sms_get_data(sms);
|
||||
struct cb_data *cbd = cb_data_new(cb, user_data);
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
if (g_at_chat_send(data->chat, "AT+CGSMS?", cgsms_prefix,
|
||||
|
@ -866,8 +866,7 @@ static void construct_ack_pdu(struct sms_data *d)
|
|||
goto err;
|
||||
|
||||
d->cnma_ack_pdu = encode_hex(pdu, tpdu_len, 0);
|
||||
|
||||
if (!d->cnma_ack_pdu)
|
||||
if (d->cnma_ack_pdu == NULL)
|
||||
goto err;
|
||||
|
||||
d->cnma_ack_pdu_len = tpdu_len;
|
||||
|
|
|
@ -153,7 +153,7 @@ static void at_stk_envelope(struct ofono_stk *stk, int length,
|
|||
char *buf = g_try_new(char, 64 + length * 2);
|
||||
int len, ret;
|
||||
|
||||
if (!cbd || !buf)
|
||||
if (cbd == NULL || buf == NULL)
|
||||
goto error;
|
||||
|
||||
len = sprintf(buf, "AT+CSIM=%i,A0C20000%02hhX",
|
||||
|
@ -236,7 +236,7 @@ static void at_stk_terminal_response(struct ofono_stk *stk, int length,
|
|||
char *buf = g_try_new(char, 64 + length * 2);
|
||||
int len, ret;
|
||||
|
||||
if (!cbd || !buf)
|
||||
if (cbd == NULL || buf == NULL)
|
||||
goto error;
|
||||
|
||||
len = sprintf(buf, "AT+CSIM=%i,A0140000%02hhX",
|
||||
|
|
|
@ -187,7 +187,7 @@ static void at_ussd_request(struct ofono_ussd *ussd, int dcs,
|
|||
char buf[512];
|
||||
enum sms_charset charset;
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
cbd->user = ussd;
|
||||
|
@ -212,7 +212,7 @@ static void at_ussd_request(struct ofono_ussd *ussd, int dcs,
|
|||
char coded_buf[321];
|
||||
char *converted = encode_hex_own_buf(pdu, len, 0, coded_buf);
|
||||
|
||||
if (!converted)
|
||||
if (converted == NULL)
|
||||
goto error;
|
||||
|
||||
snprintf(buf, sizeof(buf), "AT+CUSD=1,\"%s\",%d",
|
||||
|
@ -264,7 +264,7 @@ static void at_ussd_cancel(struct ofono_ussd *ussd,
|
|||
struct ussd_data *data = ofono_ussd_get_data(ussd);
|
||||
struct cb_data *cbd = cb_data_new(cb, user_data);
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
cbd->user = data;
|
||||
|
|
|
@ -106,7 +106,7 @@ static struct ofono_call *create_call(struct ofono_voicecall *vc, int type,
|
|||
|
||||
/* Generate a call structure for the waiting call */
|
||||
call = g_try_new0(struct ofono_call, 1);
|
||||
if (!call)
|
||||
if (call == NULL)
|
||||
return NULL;
|
||||
|
||||
call->id = ofono_voicecall_get_next_callid(vc);
|
||||
|
@ -154,7 +154,7 @@ static void clcc_poll_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
|||
if (nc && nc->status >= 2 && nc->status <= 5)
|
||||
poll_again = TRUE;
|
||||
|
||||
if (oc && (!nc || (nc->id > oc->id))) {
|
||||
if (oc && (nc == NULL || (nc->id > oc->id))) {
|
||||
enum ofono_disconnect_reason reason;
|
||||
|
||||
if (vd->local_release & (0x1 << oc->id))
|
||||
|
@ -167,7 +167,7 @@ static void clcc_poll_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
|||
reason, NULL);
|
||||
|
||||
o = o->next;
|
||||
} else if (nc && (!oc || (nc->id < oc->id))) {
|
||||
} else if (nc && (oc == NULL || (nc->id < oc->id))) {
|
||||
/* new call, signal it */
|
||||
if (nc->type == 0)
|
||||
ofono_voicecall_notify(vc, nc);
|
||||
|
@ -309,7 +309,7 @@ static void atd_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
|||
|
||||
/* Generate a voice call that was just dialed, we guess the ID */
|
||||
call = create_call(vc, 0, 0, 2, num, type, validity);
|
||||
if (!call) {
|
||||
if (call == NULL) {
|
||||
ofono_error("Unable to malloc, call tracking will fail!");
|
||||
return;
|
||||
}
|
||||
|
@ -339,7 +339,7 @@ static void at_dial(struct ofono_voicecall *vc,
|
|||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
char buf[256];
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
cbd->user = vc;
|
||||
|
@ -387,7 +387,7 @@ static void at_template(const char *cmd, struct ofono_voicecall *vc,
|
|||
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
|
||||
struct change_state_req *req = g_try_new0(struct change_state_req, 1);
|
||||
|
||||
if (!req)
|
||||
if (req == NULL)
|
||||
goto error;
|
||||
|
||||
req->vc = vc;
|
||||
|
@ -467,7 +467,7 @@ static void at_release_specific(struct ofono_voicecall *vc, int id,
|
|||
struct release_id_req *req = g_try_new0(struct release_id_req, 1);
|
||||
char buf[32];
|
||||
|
||||
if (!req)
|
||||
if (req == NULL)
|
||||
goto error;
|
||||
|
||||
req->vc = vc;
|
||||
|
@ -571,14 +571,14 @@ static void at_send_dtmf(struct ofono_voicecall *vc, const char *dtmf,
|
|||
int i;
|
||||
char *buf;
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
cbd->user = vd;
|
||||
|
||||
/* strlen("+VTS=T;") = 7 + initial AT + null */
|
||||
buf = g_try_new(char, len * 9 + 3);
|
||||
if (!buf)
|
||||
if (buf == NULL)
|
||||
goto error;
|
||||
|
||||
s = sprintf(buf, "AT+VTS=%c", dtmf[0]);
|
||||
|
@ -620,8 +620,7 @@ static void ring_notify(GAtResult *result, gpointer user_data)
|
|||
|
||||
/* Generate an incoming call of unknown type */
|
||||
call = create_call(vc, 9, 1, 4, NULL, 128, 2);
|
||||
|
||||
if (!call) {
|
||||
if (call == NULL) {
|
||||
ofono_error("Couldn't create call, call management is fubar!");
|
||||
return;
|
||||
}
|
||||
|
@ -788,7 +787,7 @@ static void ccwa_notify(GAtResult *result, gpointer user_data)
|
|||
|
||||
call = create_call(vc, class_to_call_type(cls), 1, 5,
|
||||
num, num_type, validity);
|
||||
if (!call) {
|
||||
if (call == NULL) {
|
||||
ofono_error("Unable to malloc. Call management is fubar");
|
||||
return;
|
||||
}
|
||||
|
@ -887,7 +886,7 @@ static int at_voicecall_probe(struct ofono_voicecall *vc, unsigned int vendor,
|
|||
struct voicecall_data *vd;
|
||||
|
||||
vd = g_try_new0(struct voicecall_data, 1);
|
||||
if (!vd)
|
||||
if (vd == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
vd->chat = g_at_chat_clone(chat);
|
||||
|
|
|
@ -101,7 +101,7 @@ static void calypso_stk_envelope(struct ofono_stk *stk, int length,
|
|||
|
||||
DBG("");
|
||||
|
||||
if (!cbd || !buf)
|
||||
if (cbd == NULL || buf == NULL)
|
||||
goto error;
|
||||
|
||||
len = sprintf(buf, "AT%%SATE=\"");
|
||||
|
@ -148,7 +148,7 @@ static void calypso_stk_terminal_response(struct ofono_stk *stk, int length,
|
|||
|
||||
DBG("");
|
||||
|
||||
if (!cbd || !buf)
|
||||
if (cbd == NULL || buf == NULL)
|
||||
goto error;
|
||||
|
||||
len = sprintf(buf, "AT%%SATR=\"");
|
||||
|
@ -258,7 +258,7 @@ static int calypso_stk_probe(struct ofono_stk *stk,
|
|||
DBG("");
|
||||
|
||||
sd = g_try_new0(struct stk_data, 1);
|
||||
if (!sd)
|
||||
if (sd == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
sd->chat = g_at_chat_clone(chat);
|
||||
|
|
|
@ -64,7 +64,7 @@ static void calypso_template(struct ofono_voicecall *vc, const char *cmd,
|
|||
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
|
||||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
if (g_at_chat_send(vd->chat, cmd, none_prefix,
|
||||
|
@ -210,7 +210,7 @@ static void calypso_send_dtmf(struct ofono_voicecall *vc, const char *dtmf,
|
|||
/* strlen("+VTS=\"T\";") = 9 + initial AT + null */
|
||||
buf = g_try_new(char, len * 9 + 3);
|
||||
|
||||
if (!buf) {
|
||||
if (buf == NULL) {
|
||||
CALLBACK_WITH_FAILURE(cb, data);
|
||||
return;
|
||||
}
|
||||
|
@ -390,7 +390,7 @@ static int calypso_voicecall_probe(struct ofono_voicecall *vc,
|
|||
struct voicecall_data *vd;
|
||||
|
||||
vd = g_try_new0(struct voicecall_data, 1);
|
||||
if (!vd)
|
||||
if (vd == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
vd->chat = g_at_chat_clone(chat);
|
||||
|
|
|
@ -73,7 +73,7 @@ static void hfp_speaker_volume(struct ofono_call_volume *cv,
|
|||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
char buf[64];
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
vd->sp_volume = percent;
|
||||
|
@ -100,7 +100,7 @@ static void hfp_microphone_volume(struct ofono_call_volume *cv,
|
|||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
char buf[64];
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
vd->mic_volume = percent;
|
||||
|
|
|
@ -236,7 +236,7 @@ static void hfp_registration_status(struct ofono_netreg *netreg,
|
|||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
gboolean ok;
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
cbd->user = netreg;
|
||||
|
@ -259,7 +259,7 @@ static void hfp_current_operator(struct ofono_netreg *netreg,
|
|||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
gboolean ok;
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
cbd->user = netreg;
|
||||
|
@ -284,7 +284,7 @@ static void hfp_signal_strength(struct ofono_netreg *netreg,
|
|||
struct netreg_data *nd = ofono_netreg_get_data(netreg);
|
||||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
cbd->user = netreg;
|
||||
|
|
|
@ -80,7 +80,7 @@ static GSList *find_dialing(GSList *calls)
|
|||
c = g_slist_find_custom(calls, GINT_TO_POINTER(CALL_STATUS_DIALING),
|
||||
at_util_call_compare_by_status);
|
||||
|
||||
if (!c)
|
||||
if (c == NULL)
|
||||
c = g_slist_find_custom(calls,
|
||||
GINT_TO_POINTER(CALL_STATUS_ALERTING),
|
||||
at_util_call_compare_by_status);
|
||||
|
@ -97,8 +97,7 @@ static struct ofono_call *create_call(struct ofono_voicecall *vc, int type,
|
|||
|
||||
/* Generate a call structure for the waiting call */
|
||||
call = g_try_new0(struct ofono_call, 1);
|
||||
|
||||
if (!call)
|
||||
if (call == NULL)
|
||||
return NULL;
|
||||
|
||||
call->id = ofono_voicecall_get_next_callid(vc);
|
||||
|
@ -225,7 +224,7 @@ static void clcc_poll_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
|||
if (nc && (nc->status == CALL_STATUS_HELD))
|
||||
num_held++;
|
||||
|
||||
if (oc && (!nc || (nc->id > oc->id))) {
|
||||
if (oc && (nc == NULL || (nc->id > oc->id))) {
|
||||
enum ofono_disconnect_reason reason;
|
||||
|
||||
if (vd->local_release & (0x1 << oc->id))
|
||||
|
@ -240,7 +239,7 @@ static void clcc_poll_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
|||
vd->local_release &= ~(1 << oc->id);
|
||||
|
||||
o = o->next;
|
||||
} else if (nc && (!oc || (nc->id < oc->id))) {
|
||||
} else if (nc && (oc == NULL || (nc->id < oc->id))) {
|
||||
/* new call, signal it */
|
||||
if (nc->type == 0)
|
||||
ofono_voicecall_notify(vc, nc);
|
||||
|
@ -344,8 +343,7 @@ static void atd_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
|||
}
|
||||
|
||||
call = create_call(vc, 0, 0, CALL_STATUS_DIALING, NULL, type, validity);
|
||||
|
||||
if (!call) {
|
||||
if (call == NULL) {
|
||||
ofono_error("Unable to allocate call, "
|
||||
"call tracking will fail!");
|
||||
return;
|
||||
|
@ -364,7 +362,7 @@ static void hfp_dial(struct ofono_voicecall *vc,
|
|||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
char buf[256];
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
cbd->user = vc;
|
||||
|
@ -392,7 +390,7 @@ static void hfp_template(const char *cmd, struct ofono_voicecall *vc,
|
|||
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
|
||||
struct change_state_req *req = g_try_new0(struct change_state_req, 1);
|
||||
|
||||
if (!req)
|
||||
if (req == NULL)
|
||||
goto error;
|
||||
|
||||
req->vc = vc;
|
||||
|
@ -506,7 +504,7 @@ static void hfp_release_specific(struct ofono_voicecall *vc, int id,
|
|||
|
||||
req = g_try_new0(struct release_id_req, 1);
|
||||
|
||||
if (!req)
|
||||
if (req == NULL)
|
||||
goto error;
|
||||
|
||||
req->vc = vc;
|
||||
|
@ -584,7 +582,7 @@ static void hfp_send_dtmf(struct ofono_voicecall *vc, const char *dtmf,
|
|||
char *buf;
|
||||
int s;
|
||||
|
||||
if (!req)
|
||||
if (req == NULL)
|
||||
goto error;
|
||||
|
||||
req->vc = vc;
|
||||
|
@ -595,7 +593,7 @@ static void hfp_send_dtmf(struct ofono_voicecall *vc, const char *dtmf,
|
|||
/* strlen("AT+VTS=") = 7 */
|
||||
buf = g_try_new(char, strlen(dtmf) + 7);
|
||||
|
||||
if (!buf)
|
||||
if (buf == NULL)
|
||||
goto error;
|
||||
|
||||
sprintf(buf, "AT+VTS=%s", dtmf);
|
||||
|
@ -654,7 +652,7 @@ static void ccwa_notify(GAtResult *result, gpointer user_data)
|
|||
|
||||
call = create_call(vc, 0, 1, 5, num, num_type, validity);
|
||||
|
||||
if (!call) {
|
||||
if (call == NULL) {
|
||||
ofono_error("malloc call struct failed. "
|
||||
"Call management is fubar");
|
||||
return;
|
||||
|
@ -725,7 +723,7 @@ static void ring_notify(GAtResult *result, gpointer user_data)
|
|||
/* Generate an incoming call of voice type */
|
||||
call = create_call(vc, 0, 1, CALL_STATUS_INCOMING, NULL, 128, 2);
|
||||
|
||||
if (!call)
|
||||
if (call == NULL)
|
||||
ofono_error("Couldn't create call, call management is fubar!");
|
||||
|
||||
/* We don't know the number must wait for CLIP to arrive before
|
||||
|
@ -878,11 +876,11 @@ static void sync_dialing_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
|||
*/
|
||||
o = find_dialing(vd->calls);
|
||||
|
||||
if (!n && o) {
|
||||
if (n == NULL && o) {
|
||||
oc = o->data;
|
||||
release_call(vc, oc);
|
||||
vd->calls = g_slist_remove(vd->calls, oc);
|
||||
} else if (n && !o) {
|
||||
} else if (n && o == NULL) {
|
||||
nc = n->data;
|
||||
new_call_notify(vc, nc->type, nc->direction, nc->status,
|
||||
nc->phone_number.number, nc->phone_number.type,
|
||||
|
|
|
@ -156,7 +156,7 @@ static void hso_gprs_activate_primary(struct ofono_gprs_context *gc,
|
|||
char buf[AUTH_BUF_LENGTH];
|
||||
int len;
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
gcd->active_context = ctx->cid;
|
||||
|
@ -200,7 +200,7 @@ static void hso_gprs_deactivate_primary(struct ofono_gprs_context *gc,
|
|||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
char buf[128];
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
cbd->user = gc;
|
||||
|
|
|
@ -172,7 +172,7 @@ static int hso_radio_settings_probe(struct ofono_radio_settings *rs,
|
|||
struct radio_settings_data *rsd;
|
||||
|
||||
rsd = g_try_new0(struct radio_settings_data, 1);
|
||||
if (!rsd)
|
||||
if (rsd == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
rsd->chat = g_at_chat_clone(chat);
|
||||
|
|
|
@ -90,7 +90,7 @@ static int huawei_audio_settings_probe(struct ofono_audio_settings *as,
|
|||
struct audio_settings_data *asd;
|
||||
|
||||
asd = g_try_new0(struct audio_settings_data, 1);
|
||||
if (!asd)
|
||||
if (asd == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
asd->chat = g_at_chat_clone(chat);
|
||||
|
|
|
@ -311,7 +311,7 @@ static void huawei_gprs_activate_primary(struct ofono_gprs_context *gc,
|
|||
|
||||
DBG("cid %u", ctx->cid);
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
gcd->active_context = ctx->cid;
|
||||
|
@ -344,7 +344,7 @@ static void huawei_gprs_deactivate_primary(struct ofono_gprs_context *gc,
|
|||
|
||||
DBG("cid %u", cid);
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
cbd->user = gc;
|
||||
|
@ -376,7 +376,7 @@ static int huawei_gprs_context_probe(struct ofono_gprs_context *gc,
|
|||
}
|
||||
|
||||
gcd = g_try_new0(struct gprs_context_data, 1);
|
||||
if (!gcd)
|
||||
if (gcd == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
gcd->chat = g_at_chat_clone(chat);
|
||||
|
|
|
@ -57,7 +57,7 @@ static struct ofono_call *create_call(struct ofono_voicecall *vc, int type,
|
|||
|
||||
/* Generate a call structure for the waiting call */
|
||||
call = g_try_new0(struct ofono_call, 1);
|
||||
if (!call)
|
||||
if (call == NULL)
|
||||
return NULL;
|
||||
|
||||
call->id = id;
|
||||
|
@ -99,7 +99,7 @@ static void huawei_template(struct ofono_voicecall *vc, const char *cmd,
|
|||
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
|
||||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
if (g_at_chat_send(vd->chat, cmd, none_prefix,
|
||||
|
@ -319,7 +319,7 @@ static void orig_notify(GAtResult *result, gpointer user_data)
|
|||
ofono_info("Call origin: id %d type %d", call_id, call_type);
|
||||
|
||||
call = create_call(vc, call_type, 0, 2, NULL, 128, 2, call_id);
|
||||
if (!call) {
|
||||
if (call == NULL) {
|
||||
ofono_error("Unable to malloc, call tracking will fail!");
|
||||
return;
|
||||
}
|
||||
|
@ -472,7 +472,7 @@ static int huawei_voicecall_probe(struct ofono_voicecall *vc,
|
|||
struct voicecall_data *vd;
|
||||
|
||||
vd = g_try_new0(struct voicecall_data, 1);
|
||||
if (!vd)
|
||||
if (vd == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
vd->chat = g_at_chat_clone(chat);
|
||||
|
|
|
@ -116,7 +116,7 @@ static int ifx_audio_settings_probe(struct ofono_audio_settings *as,
|
|||
struct audio_settings_data *asd;
|
||||
|
||||
asd = g_try_new0(struct audio_settings_data, 1);
|
||||
if (!asd)
|
||||
if (asd == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
asd->chat = g_at_chat_clone(chat);
|
||||
|
|
|
@ -122,7 +122,7 @@ static void failed_setup(struct ofono_gprs_context *gc,
|
|||
gcd->active_context = 0;
|
||||
gcd->state = STATE_IDLE;
|
||||
|
||||
if (!result) {
|
||||
if (result == NULL) {
|
||||
CALLBACK_WITH_FAILURE(gcd->up_cb, NULL, 0, NULL, NULL,
|
||||
NULL, NULL, gcd->cb_data);
|
||||
return;
|
||||
|
@ -154,7 +154,7 @@ static void session_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
|||
dns[2] = 0;
|
||||
|
||||
interface = setup_rawip(gc);
|
||||
if (!interface)
|
||||
if (interface == NULL)
|
||||
interface = "invalid";
|
||||
|
||||
CALLBACK_WITH_SUCCESS(gcd->up_cb, interface, TRUE, gcd->address,
|
||||
|
@ -446,11 +446,11 @@ static int ifx_gprs_context_probe(struct ofono_gprs_context *gc,
|
|||
return -ENODEV;
|
||||
}
|
||||
|
||||
if (!g_at_chat_get_slave(chat))
|
||||
if (g_at_chat_get_slave(chat) == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
gcd = g_try_new0(struct gprs_context_data, 1);
|
||||
if (!gcd)
|
||||
if (gcd == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
gcd->chat = g_at_chat_clone(chat);
|
||||
|
|
|
@ -173,7 +173,7 @@ static int ifx_radio_settings_probe(struct ofono_radio_settings *rs,
|
|||
struct radio_settings_data *rsd;
|
||||
|
||||
rsd = g_try_new0(struct radio_settings_data, 1);
|
||||
if (!rsd)
|
||||
if (rsd == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
rsd->chat = g_at_chat_clone(chat);
|
||||
|
|
|
@ -104,7 +104,7 @@ static void ifx_stk_envelope(struct ofono_stk *stk, int length,
|
|||
|
||||
DBG("");
|
||||
|
||||
if (!cbd || !buf)
|
||||
if (cbd == NULL || buf == NULL)
|
||||
goto error;
|
||||
|
||||
len = sprintf(buf, "AT+SATE=\"");
|
||||
|
@ -150,7 +150,7 @@ static void ifx_stk_terminal_response(struct ofono_stk *stk, int length,
|
|||
|
||||
DBG("");
|
||||
|
||||
if (!cbd || !buf)
|
||||
if (cbd == NULL || buf == NULL)
|
||||
goto error;
|
||||
|
||||
len = sprintf(buf, "AT+SATR=\"");
|
||||
|
@ -273,7 +273,7 @@ static int ifx_stk_probe(struct ofono_stk *stk, unsigned int vendor, void *data)
|
|||
DBG("");
|
||||
|
||||
sd = g_try_new0(struct stk_data, 1);
|
||||
if (!sd)
|
||||
if (sd == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
sd->chat = g_at_chat_clone(chat);
|
||||
|
|
|
@ -94,7 +94,7 @@ static struct ofono_call *create_call(struct ofono_voicecall *vc, int type,
|
|||
|
||||
/* Generate a call structure for the waiting call */
|
||||
call = g_try_new0(struct ofono_call, 1);
|
||||
if (!call)
|
||||
if (call == NULL)
|
||||
return NULL;
|
||||
|
||||
call->id = ofono_voicecall_get_next_callid(vc);
|
||||
|
@ -287,7 +287,7 @@ static void atd_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
|||
|
||||
/* Generate a voice call that was just dialed, we guess the ID */
|
||||
call = create_call(vc, 0, 0, 2, num, type, validity);
|
||||
if (!call) {
|
||||
if (call == NULL) {
|
||||
ofono_error("Unable to malloc, call tracking will fail!");
|
||||
return;
|
||||
}
|
||||
|
@ -311,7 +311,7 @@ static void ifx_dial(struct ofono_voicecall *vc,
|
|||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
char buf[256];
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
cbd->user = vc;
|
||||
|
@ -359,7 +359,7 @@ static void ifx_template(const char *cmd, struct ofono_voicecall *vc,
|
|||
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
|
||||
struct change_state_req *req = g_try_new0(struct change_state_req, 1);
|
||||
|
||||
if (!req)
|
||||
if (req == NULL)
|
||||
goto error;
|
||||
|
||||
req->vc = vc;
|
||||
|
@ -431,7 +431,7 @@ static void ifx_release_specific(struct ofono_voicecall *vc, int id,
|
|||
struct release_id_req *req = g_try_new0(struct release_id_req, 1);
|
||||
char buf[32];
|
||||
|
||||
if (!req)
|
||||
if (req == NULL)
|
||||
goto error;
|
||||
|
||||
req->vc = vc;
|
||||
|
@ -518,12 +518,12 @@ static void ifx_send_dtmf(struct ofono_voicecall *vc, const char *dtmf,
|
|||
int i;
|
||||
char *buf;
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
/* strlen("+VTS=T\;") = 7 + initial AT + null */
|
||||
buf = g_try_new(char, len * 7 + 3);
|
||||
if (!buf)
|
||||
if (buf == NULL)
|
||||
goto error;
|
||||
|
||||
s = sprintf(buf, "AT+VTS=%c", dtmf[0]);
|
||||
|
@ -689,7 +689,7 @@ static void ccwa_notify(GAtResult *result, gpointer user_data)
|
|||
|
||||
call = create_call(vc, class_to_call_type(cls), 1, 5,
|
||||
num, num_type, validity);
|
||||
if (!call) {
|
||||
if (call == NULL) {
|
||||
ofono_error("Unable to malloc. Call management is fubar");
|
||||
return;
|
||||
}
|
||||
|
@ -723,7 +723,7 @@ static int ifx_voicecall_probe(struct ofono_voicecall *vc, unsigned int vendor,
|
|||
struct voicecall_data *vd;
|
||||
|
||||
vd = g_try_new0(struct voicecall_data, 1);
|
||||
if (!vd)
|
||||
if (vd == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
vd->chat = g_at_chat_clone(chat);
|
||||
|
|
|
@ -107,11 +107,11 @@ static int isi_audio_settings_probe(struct ofono_audio_settings *as,
|
|||
struct audio_settings_data *asd =
|
||||
g_try_new0(struct audio_settings_data, 1);
|
||||
|
||||
if (!asd)
|
||||
if (asd == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
asd->client = g_isi_client_create(idx, PN_CALL);
|
||||
if (!asd->client) {
|
||||
if (asd->client == NULL) {
|
||||
g_free(asd);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ static void isi_audio_settings_remove(struct ofono_audio_settings *as)
|
|||
{
|
||||
struct audio_settings_data *asd = ofono_audio_settings_get_data(as);
|
||||
|
||||
if (!asd)
|
||||
if (asd == NULL)
|
||||
return;
|
||||
|
||||
ofono_audio_settings_set_data(as, NULL);
|
||||
|
|
|
@ -128,7 +128,7 @@ static void isi_set(struct ofono_call_barring *barr, const char *lock,
|
|||
DBG("lock code %s enable %d class %d password %s",
|
||||
lock, enable, cls, passwd);
|
||||
|
||||
if (!cbd || !bd)
|
||||
if (cbd == NULL || bd == NULL)
|
||||
goto error;
|
||||
|
||||
if (g_isi_request_make(bd->client, msg, sizeof(msg), SS_TIMEOUT,
|
||||
|
@ -275,7 +275,7 @@ static void isi_query(struct ofono_call_barring *barr, const char *lock,
|
|||
|
||||
DBG("barring query lock code %s", lock);
|
||||
|
||||
if (!cbd || !bd)
|
||||
if (cbd == NULL || bd == NULL)
|
||||
goto error;
|
||||
|
||||
if (g_isi_request_make(bd->client, msg, sizeof(msg), SS_TIMEOUT,
|
||||
|
@ -346,7 +346,7 @@ static void isi_set_passwd(struct ofono_call_barring *barr, const char *lock,
|
|||
DBG("lock code %s (%u) old password %s new password %s",
|
||||
lock, ss_code, old_passwd, new_passwd);
|
||||
|
||||
if (!cbd || !bd)
|
||||
if (cbd == NULL || bd == NULL)
|
||||
goto error;
|
||||
|
||||
if (g_isi_request_make(bd->client, msg, sizeof(msg), SS_TIMEOUT,
|
||||
|
@ -397,11 +397,11 @@ static int isi_call_barring_probe(struct ofono_call_barring *barr,
|
|||
GIsiModem *idx = user;
|
||||
struct barr_data *data = g_try_new0(struct barr_data, 1);
|
||||
|
||||
if (!data)
|
||||
if (data == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
data->client = g_isi_client_create(idx, PN_SS);
|
||||
if (!data->client)
|
||||
if (data->client == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
ofono_call_barring_set_data(barr, data);
|
||||
|
@ -415,7 +415,7 @@ static void isi_call_barring_remove(struct ofono_call_barring *barr)
|
|||
{
|
||||
struct barr_data *data = ofono_call_barring_get_data(barr);
|
||||
|
||||
if (!data)
|
||||
if (data == NULL)
|
||||
return;
|
||||
|
||||
ofono_call_barring_set_data(barr, NULL);
|
||||
|
|
|
@ -229,7 +229,7 @@ static void isi_registration(struct ofono_call_forwarding *cf,
|
|||
|
||||
DBG("forwarding type %d class %d", type, cls);
|
||||
|
||||
if (!cbd || !fd || !number->number || strlen(number->number) > 28)
|
||||
if (cbd == NULL || fd == NULL || !number->number || strlen(number->number) > 28)
|
||||
goto error;
|
||||
|
||||
ss_code = forw_type_to_isi_code(type);
|
||||
|
@ -349,7 +349,7 @@ static void isi_erasure(struct ofono_call_forwarding *cf, int type, int cls,
|
|||
|
||||
DBG("forwarding type %d class %d", type, cls);
|
||||
|
||||
if (!cbd || !fd)
|
||||
if (cbd == NULL || fd == NULL)
|
||||
goto error;
|
||||
|
||||
ss_code = forw_type_to_isi_code(type);
|
||||
|
@ -481,7 +481,7 @@ static void isi_query(struct ofono_call_forwarding *cf, int type, int cls,
|
|||
|
||||
DBG("forwarding type %d class %d", type, cls);
|
||||
|
||||
if (!cbd || !fd || cls != 7)
|
||||
if (cbd == NULL || fd == NULL || cls != 7)
|
||||
goto error;
|
||||
|
||||
ss_code = forw_type_to_isi_code(type);
|
||||
|
@ -540,12 +540,11 @@ static int isi_call_forwarding_probe(struct ofono_call_forwarding *cf,
|
|||
struct forw_data *data;
|
||||
|
||||
data = g_try_new0(struct forw_data, 1);
|
||||
|
||||
if (!data)
|
||||
if (data == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
data->client = g_isi_client_create(idx, PN_SS);
|
||||
if (!data->client)
|
||||
if (data->client == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
ofono_call_forwarding_set_data(cf, data);
|
||||
|
@ -560,7 +559,7 @@ static void isi_call_forwarding_remove(struct ofono_call_forwarding *cf)
|
|||
{
|
||||
struct forw_data *data = ofono_call_forwarding_get_data(cf);
|
||||
|
||||
if (!data)
|
||||
if (data == NULL)
|
||||
return;
|
||||
|
||||
ofono_call_forwarding_set_data(cf, NULL);
|
||||
|
|
|
@ -90,11 +90,11 @@ static int isi_call_meter_probe(struct ofono_call_meter *cm,
|
|||
GIsiModem *idx = user;
|
||||
struct call_meter_data *data = g_try_new0(struct call_meter_data, 1);
|
||||
|
||||
if (!data)
|
||||
if (data == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
data->client = g_isi_client_create(idx, PN_SS);
|
||||
if (!data->client)
|
||||
if (data->client == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
ofono_call_meter_set_data(cm, data);
|
||||
|
|
|
@ -177,7 +177,7 @@ static void isi_cw_query(struct ofono_call_settings *cs, int cls,
|
|||
|
||||
DBG("waiting class %d", cls);
|
||||
|
||||
if (!cbd || !sd)
|
||||
if (cbd == NULL || sd == NULL)
|
||||
goto error;
|
||||
|
||||
if (g_isi_request_make(sd->client, msg, sizeof(msg), SS_TIMEOUT,
|
||||
|
@ -268,7 +268,7 @@ static void isi_cw_set(struct ofono_call_settings *cs, int mode, int cls,
|
|||
|
||||
DBG("waiting mode %d class %d", mode, cls);
|
||||
|
||||
if (!cbd || !sd)
|
||||
if (cbd == NULL || sd == NULL)
|
||||
goto error;
|
||||
|
||||
if (g_isi_request_make(sd->client, msg, sizeof(msg), SS_TIMEOUT,
|
||||
|
@ -320,13 +320,11 @@ static int isi_call_settings_probe(struct ofono_call_settings *cs,
|
|||
struct settings_data *data;
|
||||
|
||||
data = g_try_new0(struct settings_data, 1);
|
||||
|
||||
if (!data)
|
||||
if (data == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
data->client = g_isi_client_create(idx, PN_SS);
|
||||
|
||||
if (!data->client)
|
||||
if (data->client == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
ofono_call_settings_set_data(cs, data);
|
||||
|
@ -341,7 +339,7 @@ static void isi_call_settings_remove(struct ofono_call_settings *cs)
|
|||
{
|
||||
struct settings_data *data = ofono_call_settings_get_data(cs);
|
||||
|
||||
if (!data)
|
||||
if (data == NULL)
|
||||
return;
|
||||
|
||||
ofono_call_settings_set_data(cs, NULL);
|
||||
|
|
|
@ -136,11 +136,11 @@ static int isi_cbs_probe(struct ofono_cbs *cbs, unsigned int vendor,
|
|||
0x00 /* Languages */
|
||||
};
|
||||
|
||||
if (!cd)
|
||||
if (cd == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
cd->client = g_isi_client_create(idx, PN_SMS);
|
||||
if (!cd->client)
|
||||
if (cd->client == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
ofono_cbs_set_data(cbs, cd);
|
||||
|
@ -149,8 +149,8 @@ static int isi_cbs_probe(struct ofono_cbs *cbs, unsigned int vendor,
|
|||
if (debug && (strcmp(debug, "all") == 0 || strcmp(debug, "cbs") == 0))
|
||||
g_isi_client_set_debug(cd->client, sms_debug, NULL);
|
||||
|
||||
if (!g_isi_request_make(cd->client, msg, sizeof(msg), CBS_TIMEOUT,
|
||||
routing_resp_cb, cbs))
|
||||
if (g_isi_request_make(cd->client, msg, sizeof(msg), CBS_TIMEOUT,
|
||||
routing_resp_cb, cbs) == NULL)
|
||||
DBG("Failed to set CBS routing.");
|
||||
|
||||
return 0;
|
||||
|
@ -173,7 +173,7 @@ static void isi_cbs_remove(struct ofono_cbs *cbs)
|
|||
0x00 /* Languages */
|
||||
};
|
||||
|
||||
if (!data)
|
||||
if (data == NULL)
|
||||
return;
|
||||
|
||||
if (data->client) {
|
||||
|
|
|
@ -128,7 +128,7 @@ static void isi_query_manufacturer(struct ofono_devinfo *info,
|
|||
INFO_PRODUCT_MANUFACTURER
|
||||
};
|
||||
|
||||
if (!cbd || !dev)
|
||||
if (cbd == NULL || dev == NULL)
|
||||
goto error;
|
||||
|
||||
if (g_isi_request_make(dev->client, msg, sizeof(msg),
|
||||
|
@ -152,7 +152,7 @@ static void isi_query_model(struct ofono_devinfo *info,
|
|||
INFO_PRODUCT_NAME
|
||||
};
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
if (g_isi_request_make(dev->client, msg, sizeof(msg),
|
||||
|
@ -177,7 +177,7 @@ static void isi_query_revision(struct ofono_devinfo *info,
|
|||
0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
if (!cbd || !dev)
|
||||
if (cbd == NULL || dev == NULL)
|
||||
goto error;
|
||||
|
||||
if (g_isi_request_make(dev->client, msg, sizeof(msg),
|
||||
|
@ -201,7 +201,7 @@ static void isi_query_serial(struct ofono_devinfo *info,
|
|||
INFO_SN_IMEI_PLAIN
|
||||
};
|
||||
|
||||
if (!cbd || !dev)
|
||||
if (cbd == NULL || dev == NULL)
|
||||
goto error;
|
||||
|
||||
if (g_isi_request_make(dev->client, msg, sizeof(msg),
|
||||
|
@ -252,11 +252,11 @@ static int isi_devinfo_probe(struct ofono_devinfo *info, unsigned int vendor,
|
|||
GIsiModem *idx = user;
|
||||
struct devinfo_data *data = g_try_new0(struct devinfo_data, 1);
|
||||
|
||||
if (!data)
|
||||
if (data == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
data->client = g_isi_client_create(idx, PN_PHONE_INFO);
|
||||
if (!data->client) {
|
||||
if (data->client == NULL) {
|
||||
g_free(data);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ struct context_data {
|
|||
|
||||
static void reset_context(struct context_data *cd)
|
||||
{
|
||||
if (!cd)
|
||||
if (cd == NULL)
|
||||
return;
|
||||
|
||||
g_isi_remove_subscription(cd->client, PN_GPDS,
|
||||
|
@ -399,8 +399,8 @@ static void send_context_authenticate(GIsiClient *client, void *opaque)
|
|||
{ cd->password, password_len },
|
||||
};
|
||||
|
||||
if (!g_isi_request_vmake(client, iov, 4, GPDS_TIMEOUT,
|
||||
context_auth_cb, cd))
|
||||
if (g_isi_request_vmake(client, iov, 4, GPDS_TIMEOUT,
|
||||
context_auth_cb, cd) == NULL)
|
||||
gprs_up_fail(cd);
|
||||
}
|
||||
|
||||
|
@ -478,8 +478,8 @@ static gboolean create_context_cb(GIsiClient *client,
|
|||
|
||||
cd->handle = msg[1] = resp[1];
|
||||
|
||||
if (!g_isi_request_make(client, msg, sizeof(msg), GPDS_TIMEOUT,
|
||||
link_conf_cb, cd))
|
||||
if (g_isi_request_make(client, msg, sizeof(msg), GPDS_TIMEOUT,
|
||||
link_conf_cb, cd) == NULL)
|
||||
return gprs_up_fail(cd);
|
||||
|
||||
/* TODO: send context configuration at the same time? */
|
||||
|
@ -495,8 +495,8 @@ static void create_pipe_cb(GIsiPipe *pipe)
|
|||
GPDS_CONTEXT_ID_CREATE_REQ,
|
||||
};
|
||||
|
||||
if (!g_isi_request_make(cd->client, msg, sizeof(msg), GPDS_TIMEOUT,
|
||||
create_context_cb, cd))
|
||||
if (g_isi_request_make(cd->client, msg, sizeof(msg), GPDS_TIMEOUT,
|
||||
create_context_cb, cd) == NULL)
|
||||
gprs_up_fail(cd);
|
||||
}
|
||||
|
||||
|
@ -582,7 +582,7 @@ static void isi_gprs_deactivate_primary(struct ofono_gprs_context *gc,
|
|||
0x00, /* GPDS context ID, added later */
|
||||
};
|
||||
|
||||
if (!cd)
|
||||
if (cd == NULL)
|
||||
return;
|
||||
|
||||
cd->down_cb = cb;
|
||||
|
@ -590,8 +590,8 @@ static void isi_gprs_deactivate_primary(struct ofono_gprs_context *gc,
|
|||
|
||||
msg[1] = cd->handle;
|
||||
|
||||
if (!g_isi_request_make(cd->client, msg, sizeof(msg), GPDS_TIMEOUT,
|
||||
context_deactivate_cb, cd)) {
|
||||
if (g_isi_request_make(cd->client, msg, sizeof(msg), GPDS_TIMEOUT,
|
||||
context_deactivate_cb, cd) == NULL) {
|
||||
gprs_down_fail(cd);
|
||||
return;
|
||||
}
|
||||
|
@ -630,11 +630,11 @@ static int isi_gprs_context_probe(struct ofono_gprs_context *gc,
|
|||
GIsiModem *idx = user;
|
||||
struct context_data *cd = g_try_new0(struct context_data, 1);
|
||||
|
||||
if (!cd)
|
||||
if (cd == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
cd->client = g_isi_client_create(idx, PN_GPDS);
|
||||
if (!cd->client) {
|
||||
if (cd->client == NULL) {
|
||||
g_free(cd);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
@ -652,7 +652,7 @@ static void isi_gprs_context_remove(struct ofono_gprs_context *gc)
|
|||
{
|
||||
struct context_data *cd = ofono_gprs_context_get_data(gc);
|
||||
|
||||
if (!cd)
|
||||
if (cd == NULL)
|
||||
return;
|
||||
|
||||
ofono_gprs_context_set_data(gc, NULL);
|
||||
|
|
|
@ -165,11 +165,11 @@ static int isi_gprs_probe(struct ofono_gprs *gprs,
|
|||
GIsiModem *idx = user;
|
||||
struct gprs_data *gd = g_try_new0(struct gprs_data, 1);
|
||||
|
||||
if (!gd)
|
||||
if (gd == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
gd->client = g_isi_client_create(idx, PN_GPDS);
|
||||
if (!gd->client) {
|
||||
if (gd->client == NULL) {
|
||||
g_free(gd);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ static void isi_gprs_remove(struct ofono_gprs *gprs)
|
|||
{
|
||||
struct gprs_data *data = ofono_gprs_get_data(gprs);
|
||||
|
||||
if (!data)
|
||||
if (data == NULL)
|
||||
return;
|
||||
|
||||
ofono_gprs_set_data(gprs, NULL);
|
||||
|
@ -286,7 +286,7 @@ static void isi_gprs_set_attached(struct ofono_gprs *gprs, int attached,
|
|||
|
||||
GIsiRequest *req;
|
||||
|
||||
if (!cbd || !gd)
|
||||
if (cbd == NULL || gd == NULL)
|
||||
goto error;
|
||||
|
||||
if (attached)
|
||||
|
@ -356,7 +356,7 @@ static void isi_gprs_attached_status(struct ofono_gprs *gprs,
|
|||
GPDS_STATUS_REQ,
|
||||
};
|
||||
|
||||
if (!cbd || !gd)
|
||||
if (cbd == NULL || gd == NULL)
|
||||
goto error;
|
||||
|
||||
if (g_isi_send(gd->client, msg, sizeof(msg), GPDS_TIMEOUT,
|
||||
|
|
|
@ -93,11 +93,11 @@ struct isi_infoserver *isi_infoserver_create(struct ofono_modem *modem,
|
|||
struct isi_infoserver *self;
|
||||
|
||||
self = g_new0(struct isi_infoserver, 1);
|
||||
if (!self)
|
||||
if (self == NULL)
|
||||
return NULL;
|
||||
|
||||
self->server = g_isi_server_create(data, PN_EPOC_INFO, 0, 0);
|
||||
if (!self->server) {
|
||||
if (self->server == NULL) {
|
||||
g_free(self);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -255,7 +255,7 @@ static void isi_registration_status(struct ofono_netreg *netreg,
|
|||
NET_REG_STATUS_GET_REQ
|
||||
};
|
||||
|
||||
if (!cbd || !nd)
|
||||
if (cbd == NULL || nd == NULL)
|
||||
goto error;
|
||||
|
||||
if (g_isi_request_make(nd->client, msg, sizeof(msg),
|
||||
|
@ -360,7 +360,7 @@ static void isi_current_operator(struct ofono_netreg *netreg,
|
|||
0x00 /* No sub-blocks */
|
||||
};
|
||||
|
||||
if (!cbd || !nd)
|
||||
if (cbd == NULL || nd == NULL)
|
||||
goto error;
|
||||
|
||||
if (g_isi_request_make(nd->client, msg, sizeof(msg),
|
||||
|
@ -482,7 +482,7 @@ static void isi_list_operators(struct ofono_netreg *netreg,
|
|||
0x00
|
||||
};
|
||||
|
||||
if (!cbd || !net)
|
||||
if (cbd == NULL || net == NULL)
|
||||
goto error;
|
||||
|
||||
if (g_isi_request_make(net->client, msg, sizeof(msg),
|
||||
|
@ -548,7 +548,7 @@ static void isi_register_auto(struct ofono_netreg *netreg,
|
|||
0x00 /* Index not used */
|
||||
};
|
||||
|
||||
if (!cbd || !net)
|
||||
if (cbd == NULL || net == NULL)
|
||||
goto error;
|
||||
|
||||
if (g_isi_request_make(net->client, msg, sizeof(msg),
|
||||
|
@ -621,7 +621,7 @@ static void isi_register_manual(struct ofono_netreg *netreg,
|
|||
0x00, 0x00 /* Filler */
|
||||
};
|
||||
|
||||
if (!cbd || !nd)
|
||||
if (cbd == NULL || nd == NULL)
|
||||
goto error;
|
||||
|
||||
if (g_isi_request_make(nd->client, msg, sizeof(msg),
|
||||
|
@ -866,7 +866,7 @@ static void isi_strength(struct ofono_netreg *netreg,
|
|||
NET_CURRENT_CELL_RSSI
|
||||
};
|
||||
|
||||
if (!cbd || !nd)
|
||||
if (cbd == NULL || nd == NULL)
|
||||
goto error;
|
||||
|
||||
if (g_isi_request_make(nd->client, msg, sizeof(msg),
|
||||
|
@ -901,9 +901,8 @@ static gboolean isi_netreg_register(gpointer user)
|
|||
g_isi_subscribe(nd->client, NET_TIME_IND, time_ind_cb, netreg);
|
||||
|
||||
/* Bootstrap current RAT setting */
|
||||
if (!g_isi_request_make(nd->client, rat, sizeof(rat),
|
||||
NETWORK_TIMEOUT,
|
||||
rat_resp_cb, netreg))
|
||||
if (g_isi_request_make(nd->client, rat, sizeof(rat),
|
||||
NETWORK_TIMEOUT, rat_resp_cb, netreg) == NULL)
|
||||
DBG("Failed to bootstrap RAT");
|
||||
|
||||
ofono_netreg_register(netreg);
|
||||
|
@ -935,11 +934,11 @@ static int isi_netreg_probe(struct ofono_netreg *netreg, unsigned int vendor,
|
|||
GIsiModem *idx = user;
|
||||
struct netreg_data *nd = g_try_new0(struct netreg_data, 1);
|
||||
|
||||
if (!nd)
|
||||
if (nd == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
nd->client = g_isi_client_create(idx, PN_NETWORK);
|
||||
if (!nd->client) {
|
||||
if (nd->client == NULL) {
|
||||
g_free(nd);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
@ -954,7 +953,7 @@ static void isi_netreg_remove(struct ofono_netreg *net)
|
|||
{
|
||||
struct netreg_data *data = ofono_netreg_get_data(net);
|
||||
|
||||
if (!data)
|
||||
if (data == NULL)
|
||||
return;
|
||||
|
||||
ofono_netreg_set_data(net, NULL);
|
||||
|
|
|
@ -192,7 +192,7 @@ static void read_next_entry(GIsiClient *client, int location,
|
|||
if (location < 0)
|
||||
goto error;
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
if (g_isi_request_make(client, msg, sizeof(msg), SIM_TIMEOUT,
|
||||
|
@ -259,7 +259,7 @@ static void isi_export_entries(struct ofono_phonebook *pb, const char *storage,
|
|||
0, 0 /* filler */
|
||||
};
|
||||
|
||||
if (!cbd || !pbd)
|
||||
if (cbd == NULL || pbd == NULL)
|
||||
goto error;
|
||||
|
||||
if (strcmp(storage, "SM"))
|
||||
|
@ -314,11 +314,11 @@ static int isi_phonebook_probe(struct ofono_phonebook *pb, unsigned int vendor,
|
|||
GIsiModem *idx = user;
|
||||
struct pb_data *data = g_try_new0(struct pb_data, 1);
|
||||
|
||||
if (!data)
|
||||
if (data == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
data->client = g_isi_client_create(idx, PN_SIM);
|
||||
if (!data->client) {
|
||||
if (data->client == NULL) {
|
||||
g_free(data);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
@ -335,7 +335,7 @@ static void isi_phonebook_remove(struct ofono_phonebook *pb)
|
|||
{
|
||||
struct pb_data *data = ofono_phonebook_get_data(pb);
|
||||
|
||||
if (!data)
|
||||
if (data == NULL)
|
||||
return;
|
||||
|
||||
ofono_phonebook_set_data(pb, NULL);
|
||||
|
|
|
@ -159,7 +159,7 @@ static void isi_query_rat_mode(struct ofono_radio_settings *rs,
|
|||
0x00 /* subblock count */
|
||||
};
|
||||
|
||||
if (!cbd || !rd)
|
||||
if (cbd == NULL || rd == NULL)
|
||||
goto error;
|
||||
|
||||
if (g_isi_request_make(rd->client, msg, sizeof(msg), GSS_TIMEOUT,
|
||||
|
@ -226,7 +226,7 @@ static void isi_set_rat_mode(struct ofono_radio_settings *rs,
|
|||
0x00 /* filler */
|
||||
};
|
||||
|
||||
if (!cbd || !rd)
|
||||
if (cbd == NULL || rd == NULL)
|
||||
goto error;
|
||||
|
||||
if (isi_mode == -1)
|
||||
|
@ -363,11 +363,11 @@ static int isi_radio_settings_probe(struct ofono_radio_settings *rs,
|
|||
GIsiModem *idx = user;
|
||||
struct radio_data *rd = g_try_new0(struct radio_data, 1);
|
||||
|
||||
if (!rd)
|
||||
if (rd == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
rd->client = g_isi_client_create(idx, PN_GSS);
|
||||
if (!rd->client) {
|
||||
if (rd->client == NULL) {
|
||||
g_free(rd);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
@ -384,7 +384,7 @@ static void isi_radio_settings_remove(struct ofono_radio_settings *rs)
|
|||
{
|
||||
struct radio_data *rd = ofono_radio_settings_get_data(rs);
|
||||
|
||||
if (!rd)
|
||||
if (rd == NULL)
|
||||
return;
|
||||
|
||||
ofono_radio_settings_set_data(rs, NULL);
|
||||
|
|
|
@ -156,7 +156,7 @@ static gboolean isi_read_spn(struct ofono_sim *sim, struct isi_cb_data *cbd)
|
|||
0
|
||||
};
|
||||
|
||||
if (!sd)
|
||||
if (sd == NULL)
|
||||
return FALSE;
|
||||
|
||||
return g_isi_request_make(sd->client, msg, sizeof(msg),
|
||||
|
@ -200,7 +200,7 @@ static gboolean isi_read_iccid(struct ofono_sim *sim, struct isi_cb_data *cbd)
|
|||
struct sim_data *sd = ofono_sim_get_data(sim);
|
||||
const unsigned char req[] = { SIM_READ_FIELD_REQ, ICC };
|
||||
|
||||
if (!sd)
|
||||
if (sd == NULL)
|
||||
return FALSE;
|
||||
|
||||
return g_isi_request_make(sd->client, req, sizeof(req), SIM_TIMEOUT,
|
||||
|
@ -343,7 +343,7 @@ static void isi_read_imsi(struct ofono_sim *sim,
|
|||
READ_IMSI
|
||||
};
|
||||
|
||||
if (!cbd || !sd)
|
||||
if (cbd == NULL || sd == NULL)
|
||||
goto error;
|
||||
|
||||
if (g_isi_request_make(sd->client, msg, sizeof(msg), SIM_TIMEOUT,
|
||||
|
@ -451,11 +451,11 @@ static int isi_sim_probe(struct ofono_sim *sim, unsigned int vendor,
|
|||
struct sim_data *sd = g_try_new0(struct sim_data, 1);
|
||||
const char *debug = getenv("OFONO_ISI_DEBUG");
|
||||
|
||||
if (!sd)
|
||||
if (sd == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
sd->client = g_isi_client_create(idx, PN_SIM);
|
||||
if (!sd->client)
|
||||
if (sd->client == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
ofono_sim_set_data(sim, sd);
|
||||
|
@ -472,7 +472,7 @@ static void isi_sim_remove(struct ofono_sim *sim)
|
|||
{
|
||||
struct sim_data *data = ofono_sim_get_data(sim);
|
||||
|
||||
if (!data)
|
||||
if (data == NULL)
|
||||
return;
|
||||
|
||||
ofono_sim_set_data(sim, NULL);
|
||||
|
|
|
@ -156,7 +156,7 @@ static void isi_sca_query(struct ofono_sms *sms,
|
|||
1, /* Location, default is 1 */
|
||||
};
|
||||
|
||||
if (!cbd || !sd)
|
||||
if (cbd == NULL || sd == NULL)
|
||||
goto error;
|
||||
|
||||
if (g_isi_send(sd->sim, msg, sizeof(msg), SIM_TIMEOUT,
|
||||
|
@ -214,7 +214,7 @@ static void isi_sca_set(struct ofono_sms *sms,
|
|||
{ &sd->params, sizeof(sd->params) },
|
||||
};
|
||||
|
||||
if (!cbd || !sd)
|
||||
if (cbd == NULL || sd == NULL)
|
||||
goto error;
|
||||
|
||||
bcd = sd->params.sca;
|
||||
|
@ -350,7 +350,7 @@ static void isi_submit(struct ofono_sms *sms, unsigned char *pdu,
|
|||
{ sca_sb, sca_sb_len },
|
||||
};
|
||||
|
||||
if (!cbd || !sd)
|
||||
if (cbd == NULL || sd == NULL)
|
||||
goto error;
|
||||
|
||||
if (use_sca) {
|
||||
|
@ -560,18 +560,18 @@ static int isi_sms_probe(struct ofono_sms *sms, unsigned int vendor,
|
|||
0x00 /* Sub-sub-block count */
|
||||
};
|
||||
|
||||
if (!data)
|
||||
if (data == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
data->params.absent = 0xff;
|
||||
data->params.alphalen = 1; /* Includes final UCS2-coded NUL */
|
||||
|
||||
data->client = g_isi_client_create(idx, PN_SMS);
|
||||
if (!data->client)
|
||||
if (data->client == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
data->sim = g_isi_client_create(idx, PN_SIM);
|
||||
if (!data->sim) {
|
||||
if (data->sim == NULL) {
|
||||
g_isi_client_destroy(data->client);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
@ -586,8 +586,8 @@ static int isi_sms_probe(struct ofono_sms *sms, unsigned int vendor,
|
|||
|
||||
g_isi_subscribe(data->client, SMS_MESSAGE_SEND_STATUS_IND,
|
||||
send_status_ind_cb, sms);
|
||||
if (!g_isi_send(data->client, msg, sizeof(msg), SMS_TIMEOUT,
|
||||
routing_resp_cb, sms, NULL))
|
||||
if (g_isi_send(data->client, msg, sizeof(msg), SMS_TIMEOUT,
|
||||
routing_resp_cb, sms, NULL) == NULL)
|
||||
DBG("Failed to set SMS routing.");
|
||||
|
||||
return 0;
|
||||
|
@ -609,7 +609,7 @@ static void isi_sms_remove(struct ofono_sms *sms)
|
|||
0x00 /* Sub-sub-block count */
|
||||
};
|
||||
|
||||
if (!data)
|
||||
if (data == NULL)
|
||||
return;
|
||||
|
||||
ofono_sms_set_data(sms, NULL);
|
||||
|
|
|
@ -51,11 +51,11 @@ static int isi_ssn_probe(struct ofono_ssn *ssn, unsigned int vendor,
|
|||
GIsiModem *idx = user;
|
||||
struct ssn_data *data = g_try_new0(struct ssn_data, 1);
|
||||
|
||||
if (!data)
|
||||
if (data == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
data->client = g_isi_client_create(idx, PN_SS);
|
||||
if (!data->client)
|
||||
if (data->client == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
ofono_ssn_set_data(ssn, data);
|
||||
|
@ -67,7 +67,7 @@ static void isi_ssn_remove(struct ofono_ssn *ssn)
|
|||
{
|
||||
struct ssn_data *data = ofono_ssn_get_data(ssn);
|
||||
|
||||
if (!data)
|
||||
if (data == NULL)
|
||||
return;
|
||||
|
||||
ofono_ssn_set_data(ssn, NULL);
|
||||
|
|
|
@ -181,7 +181,7 @@ static void isi_request(struct ofono_ussd *ussd, int dcs,
|
|||
{ (uint8_t *)pdu, len }
|
||||
};
|
||||
|
||||
if (!cbd || !ud)
|
||||
if (cbd == NULL || ud == NULL)
|
||||
goto error;
|
||||
|
||||
if (g_isi_vsend(ud->client, iov, 2, SS_TIMEOUT,
|
||||
|
@ -205,7 +205,7 @@ static void isi_cancel(struct ofono_ussd *ussd,
|
|||
0x00 /* subblock count */
|
||||
};
|
||||
|
||||
if (!cbd || !ud)
|
||||
if (cbd == NULL || ud == NULL)
|
||||
goto error;
|
||||
|
||||
if (g_isi_send(ud->client, msg, sizeof(msg), SS_TIMEOUT,
|
||||
|
@ -258,11 +258,11 @@ static int isi_ussd_probe(struct ofono_ussd *ussd, unsigned int vendor,
|
|||
GIsiModem *idx = user;
|
||||
struct ussd_data *ud = g_try_new0(struct ussd_data, 1);
|
||||
|
||||
if (!ud)
|
||||
if (ud == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
ud->client = g_isi_client_create(idx, PN_SS);
|
||||
if (!ud->client)
|
||||
if (ud->client == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
ofono_ussd_set_data(ussd, ud);
|
||||
|
@ -275,7 +275,7 @@ static void isi_ussd_remove(struct ofono_ussd *ussd)
|
|||
{
|
||||
struct ussd_data *data = ofono_ussd_get_data(ussd);
|
||||
|
||||
if (!data)
|
||||
if (data == NULL)
|
||||
return;
|
||||
|
||||
ofono_ussd_set_data(ussd, NULL);
|
||||
|
|
|
@ -176,7 +176,7 @@ static gboolean isi_ctx_return(struct isi_call_req_context *irc,
|
|||
enum ofono_error_type type,
|
||||
int error)
|
||||
{
|
||||
if (!irc)
|
||||
if (irc == NULL)
|
||||
return TRUE;
|
||||
|
||||
if (irc->cb) {
|
||||
|
@ -1252,14 +1252,14 @@ static int isi_voicecall_probe(struct ofono_voicecall *ovc,
|
|||
struct isi_voicecall *ivc = g_try_new0(struct isi_voicecall, 1);
|
||||
int id;
|
||||
|
||||
if (!ivc)
|
||||
if (ivc == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
for (id = 0; id <= 7; id++)
|
||||
ivc->calls[id].id = id;
|
||||
|
||||
ivc->client = g_isi_client_create(idx, PN_CALL);
|
||||
if (!ivc->client) {
|
||||
if (ivc->client == NULL) {
|
||||
g_free(ivc);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
@ -1302,9 +1302,9 @@ static gboolean isi_call_register(gpointer _ovc)
|
|||
CALL_STATUS_IND, isi_call_status_ind_cb,
|
||||
ovc);
|
||||
|
||||
if (!isi_call_status_req(ovc, CALL_ID_ALL,
|
||||
CALL_STATUS_MODE_ADDR_AND_ORIGIN,
|
||||
NULL, NULL))
|
||||
if (isi_call_status_req(ovc, CALL_ID_ALL,
|
||||
CALL_STATUS_MODE_ADDR_AND_ORIGIN,
|
||||
NULL, NULL) == NULL)
|
||||
DBG("Failed to request call status");
|
||||
|
||||
ofono_voicecall_register(ovc);
|
||||
|
@ -1316,7 +1316,7 @@ static void isi_voicecall_remove(struct ofono_voicecall *call)
|
|||
{
|
||||
struct isi_voicecall *data = ofono_voicecall_get_data(call);
|
||||
|
||||
if (!data)
|
||||
if (data == NULL)
|
||||
return;
|
||||
|
||||
ofono_voicecall_set_data(call, NULL);
|
||||
|
|
|
@ -364,7 +364,7 @@ static void mbm_gprs_activate_primary(struct ofono_gprs_context *gc,
|
|||
|
||||
DBG("cid %u", ctx->cid);
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
gcd->active_context = ctx->cid;
|
||||
|
@ -408,7 +408,7 @@ static void mbm_gprs_deactivate_primary(struct ofono_gprs_context *gc,
|
|||
|
||||
DBG("cid %u", cid);
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
cbd->user = gc;
|
||||
|
@ -471,7 +471,7 @@ static int mbm_gprs_context_probe(struct ofono_gprs_context *gc,
|
|||
DBG("");
|
||||
|
||||
gcd = g_try_new0(struct gprs_context_data, 1);
|
||||
if (!gcd)
|
||||
if (gcd == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
gcd->chat = g_at_chat_clone(chat);
|
||||
|
|
|
@ -88,7 +88,7 @@ static void mbm_stk_envelope(struct ofono_stk *stk, int length,
|
|||
|
||||
DBG("");
|
||||
|
||||
if (!cbd || !buf)
|
||||
if (cbd == NULL || buf == NULL)
|
||||
goto error;
|
||||
|
||||
len = sprintf(buf, "AT*STKE=\"");
|
||||
|
@ -134,7 +134,7 @@ static void mbm_stk_terminal_response(struct ofono_stk *stk, int length,
|
|||
|
||||
DBG("");
|
||||
|
||||
if (!cbd || !buf)
|
||||
if (cbd == NULL || buf == NULL)
|
||||
goto error;
|
||||
|
||||
len = sprintf(buf, "AT*STKR=\"");
|
||||
|
@ -236,7 +236,7 @@ static int mbm_stk_probe(struct ofono_stk *stk, unsigned int vendor, void *data)
|
|||
DBG("");
|
||||
|
||||
sd = g_try_new0(struct stk_data, 1);
|
||||
if (!sd)
|
||||
if (sd == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
sd->chat = g_at_chat_clone(chat);
|
||||
|
|
|
@ -170,7 +170,7 @@ static int nw_radio_settings_probe(struct ofono_radio_settings *rs,
|
|||
struct radio_settings_data *rsd;
|
||||
|
||||
rsd = g_try_new0(struct radio_settings_data, 1);
|
||||
if (!rsd)
|
||||
if (rsd == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
rsd->chat = g_at_chat_clone(chat);
|
||||
|
|
|
@ -158,7 +158,7 @@ static struct conn_info *conn_info_create(unsigned int device,
|
|||
{
|
||||
struct conn_info *connection = g_try_new0(struct conn_info, 1);
|
||||
|
||||
if (!connection)
|
||||
if (connection == NULL)
|
||||
return NULL;
|
||||
|
||||
connection->cid = 0;
|
||||
|
@ -206,7 +206,7 @@ static void ste_eppsd_down_cb(gboolean ok, GAtResult *result,
|
|||
GUINT_TO_POINTER(gcd->active_context),
|
||||
conn_compare_by_cid);
|
||||
|
||||
if (!l) {
|
||||
if (l == NULL) {
|
||||
DBG("Did not find data (used caif device) for"
|
||||
"connection with cid; %d",
|
||||
gcd->active_context);
|
||||
|
@ -247,7 +247,7 @@ static void ste_eppsd_up_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
|||
GUINT_TO_POINTER(gcd->active_context),
|
||||
conn_compare_by_cid);
|
||||
|
||||
if (!l) {
|
||||
if (l == NULL) {
|
||||
DBG("Did not find data (device and channel id)"
|
||||
"for connection with cid; %d",
|
||||
gcd->active_context);
|
||||
|
@ -344,7 +344,7 @@ static void ste_cgdcont_cb(gboolean ok, GAtResult *result, gpointer user_data)
|
|||
l = g_slist_find_custom(g_caif_devices, GUINT_TO_POINTER(0),
|
||||
conn_compare_by_cid);
|
||||
|
||||
if (!l) {
|
||||
if (l == NULL) {
|
||||
DBG("at_cgdcont_cb, no more available devices");
|
||||
goto error;
|
||||
}
|
||||
|
@ -376,7 +376,7 @@ static void ste_gprs_activate_primary(struct ofono_gprs_context *gc,
|
|||
char buf[AUTH_BUF_LENGTH];
|
||||
int len;
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
gcd->active_context = ctx->cid;
|
||||
|
@ -421,7 +421,7 @@ static void ste_gprs_deactivate_primary(struct ofono_gprs_context *gc,
|
|||
char buf[64];
|
||||
GSList *l;
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
gcd->active_context = id;
|
||||
|
@ -430,7 +430,7 @@ static void ste_gprs_deactivate_primary(struct ofono_gprs_context *gc,
|
|||
l = g_slist_find_custom(g_caif_devices, GUINT_TO_POINTER(id),
|
||||
conn_compare_by_cid);
|
||||
|
||||
if (!l) {
|
||||
if (l == NULL) {
|
||||
DBG("at_gprs_deactivate_primary, did not find"
|
||||
"data (channel id) for connection with cid; %d", id);
|
||||
goto error;
|
||||
|
|
|
@ -192,8 +192,9 @@ static int ste_radio_settings_probe(struct ofono_radio_settings *rs,
|
|||
{
|
||||
GAtChat *chat = data;
|
||||
struct radio_settings_data *rsd;
|
||||
|
||||
rsd = g_try_new0(struct radio_settings_data, 1);
|
||||
if (!rsd)
|
||||
if (rsd == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
rsd->chat = chat;
|
||||
|
|
|
@ -109,7 +109,7 @@ static struct ofono_call *create_call(struct ofono_voicecall *vc, int type,
|
|||
|
||||
/* Generate a call structure for the waiting call */
|
||||
call = g_try_new0(struct ofono_call, 1);
|
||||
if (!call)
|
||||
if (call == NULL)
|
||||
return NULL;
|
||||
|
||||
call->type = type;
|
||||
|
@ -187,7 +187,7 @@ static void ste_dial(struct ofono_voicecall *vc,
|
|||
struct cb_data *cbd = cb_data_new(cb, data);
|
||||
char buf[256];
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
cbd->user = vc;
|
||||
|
@ -235,7 +235,7 @@ static void ste_template(const char *cmd, struct ofono_voicecall *vc,
|
|||
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
|
||||
struct change_state_req *req = g_try_new0(struct change_state_req, 1);
|
||||
|
||||
if (!req)
|
||||
if (req == NULL)
|
||||
goto error;
|
||||
|
||||
req->vc = vc;
|
||||
|
@ -299,7 +299,7 @@ static void ste_release_specific(struct ofono_voicecall *vc, int id,
|
|||
struct release_id_req *req = g_try_new0(struct release_id_req, 1);
|
||||
char buf[32];
|
||||
|
||||
if (!req)
|
||||
if (req == NULL)
|
||||
goto error;
|
||||
|
||||
req->vc = vc;
|
||||
|
@ -379,13 +379,13 @@ static void ste_send_dtmf(struct ofono_voicecall *vc, const char *dtmf,
|
|||
int s;
|
||||
char *buf;
|
||||
|
||||
if (!cbd)
|
||||
if (cbd == NULL)
|
||||
goto error;
|
||||
|
||||
/* strlen("AT+VTS=) = 7 */
|
||||
buf = g_try_new(char, len + 7);
|
||||
|
||||
if (!buf)
|
||||
if (buf == NULL)
|
||||
goto error;
|
||||
|
||||
sprintf(buf, "AT+VTS=%s", dtmf);
|
||||
|
@ -506,7 +506,7 @@ static void ecav_notify(GAtResult *result, gpointer user_data)
|
|||
|
||||
new_call = create_call(vc, call_type, direction, status,
|
||||
num, num_type, clip_validity);
|
||||
if (!new_call) {
|
||||
if (new_call == NULL) {
|
||||
ofono_error("Unable to malloc. "
|
||||
"Call management is fubar");
|
||||
return;
|
||||
|
@ -546,7 +546,7 @@ static int ste_voicecall_probe(struct ofono_voicecall *vc, unsigned int vendor,
|
|||
struct voicecall_data *vd;
|
||||
|
||||
vd = g_try_new0(struct voicecall_data, 1);
|
||||
if (!vd)
|
||||
if (vd == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
vd->chat = g_at_chat_clone(chat);
|
||||
|
|
Loading…
Reference in New Issue