summaryrefslogtreecommitdiffstats
path: root/drivers/atmodem
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@profusion.mobi>2010-11-27 17:38:56 -0200
committerDenis Kenzior <denkenz@gmail.com>2010-11-29 11:37:09 -0600
commitb82a7f851159a42f6ca38a2357551a94a4402e11 (patch)
tree6bf00675085885091b496bf1b0ab899b9a8f79e3 /drivers/atmodem
parent43d2435e64e4448cbdce222c68cb1352c5c74276 (diff)
downloadofono-b82a7f851159a42f6ca38a2357551a94a4402e11.tar.bz2
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>
Diffstat (limited to 'drivers/atmodem')
-rw-r--r--drivers/atmodem/atutil.c3
-rw-r--r--drivers/atmodem/atutil.h3
-rw-r--r--drivers/atmodem/call-barring.c6
-rw-r--r--drivers/atmodem/call-forwarding.c4
-rw-r--r--drivers/atmodem/call-meter.c14
-rw-r--r--drivers/atmodem/call-settings.c14
-rw-r--r--drivers/atmodem/call-volume.c4
-rw-r--r--drivers/atmodem/cbs.c7
-rw-r--r--drivers/atmodem/devinfo.c8
-rw-r--r--drivers/atmodem/gprs-context.c2
-rw-r--r--drivers/atmodem/gprs.c6
-rw-r--r--drivers/atmodem/network-registration.c19
-rw-r--r--drivers/atmodem/phonebook.c4
-rw-r--r--drivers/atmodem/sim-poll.c2
-rw-r--r--drivers/atmodem/sim.c32
-rw-r--r--drivers/atmodem/sms.c13
-rw-r--r--drivers/atmodem/stk.c4
-rw-r--r--drivers/atmodem/ussd.c6
-rw-r--r--drivers/atmodem/voicecall.c25
19 files changed, 85 insertions, 91 deletions
diff --git a/drivers/atmodem/atutil.c b/drivers/atmodem/atutil.c
index fe7cbfc1..b6f0d92a 100644
--- a/drivers/atmodem/atutil.c
+++ b/drivers/atmodem/atutil.c
@@ -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;
diff --git a/drivers/atmodem/atutil.h b/drivers/atmodem/atutil.h
index 7dbb8a6d..39018016 100644
--- a/drivers/atmodem/atutil.h
+++ b/drivers/atmodem/atutil.h
@@ -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;
diff --git a/drivers/atmodem/call-barring.c b/drivers/atmodem/call-barring.c
index 50e0eefc..c0b1d115 100644
--- a/drivers/atmodem/call-barring.c
+++ b/drivers/atmodem/call-barring.c
@@ -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\"",
diff --git a/drivers/atmodem/call-forwarding.c b/drivers/atmodem/call-forwarding.c
index d20ac2e8..a74d4c36 100644
--- a/drivers/atmodem/call-forwarding.c
+++ b/drivers/atmodem/call-forwarding.c
@@ -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,
diff --git a/drivers/atmodem/call-meter.c b/drivers/atmodem/call-meter.c
index 28359afb..5c933971 100644
--- a/drivers/atmodem/call-meter.c
+++ b/drivers/atmodem/call-meter.c
@@ -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\"",
diff --git a/drivers/atmodem/call-settings.c b/drivers/atmodem/call-settings.c
index b5acc02f..05c94387 100644
--- a/drivers/atmodem/call-settings.c
+++ b/drivers/atmodem/call-settings.c
@@ -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,
diff --git a/drivers/atmodem/call-volume.c b/drivers/atmodem/call-volume.c
index 76d2f96a..fbec6684 100644
--- a/drivers/atmodem/call-volume.c
+++ b/drivers/atmodem/call-volume.c
@@ -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);
diff --git a/drivers/atmodem/cbs.c b/drivers/atmodem/cbs.c
index 2ae75fbd..479bfea6 100644
--- a/drivers/atmodem/cbs.c
+++ b/drivers/atmodem/cbs.c
@@ -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)
diff --git a/drivers/atmodem/devinfo.c b/drivers/atmodem/devinfo.c
index 4d3cf983..84ff8988 100644
--- a/drivers/atmodem/devinfo.c
+++ b/drivers/atmodem/devinfo.c
@@ -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:";
diff --git a/drivers/atmodem/gprs-context.c b/drivers/atmodem/gprs-context.c
index 03c6f466..6b657f3f 100644
--- a/drivers/atmodem/gprs-context.c
+++ b/drivers/atmodem/gprs-context.c
@@ -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);
diff --git a/drivers/atmodem/gprs.c b/drivers/atmodem/gprs.c
index 94247eca..8cff35b7 100644
--- a/drivers/atmodem/gprs.c
+++ b/drivers/atmodem/gprs.c
@@ -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);
diff --git a/drivers/atmodem/network-registration.c b/drivers/atmodem/network-registration.c
index 5b87b39a..04b0d48c 100644
--- a/drivers/atmodem/network-registration.c
+++ b/drivers/atmodem/network-registration.c
@@ -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;
diff --git a/drivers/atmodem/phonebook.c b/drivers/atmodem/phonebook.c
index dede2352..731205e5 100644
--- a/drivers/atmodem/phonebook.c
+++ b/drivers/atmodem/phonebook.c
@@ -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);
diff --git a/drivers/atmodem/sim-poll.c b/drivers/atmodem/sim-poll.c
index ae1b55c3..daef24a2 100644
--- a/drivers/atmodem/sim-poll.c
+++ b/drivers/atmodem/sim-poll.c
@@ -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);
diff --git a/drivers/atmodem/sim.c b/drivers/atmodem/sim.c
index 9cfdc650..1653ede7 100644
--- a/drivers/atmodem/sim.c
+++ b/drivers/atmodem/sim.c
@@ -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",
diff --git a/drivers/atmodem/sms.c b/drivers/atmodem/sms.c
index 02cd27a1..559b570f 100644
--- a/drivers/atmodem/sms.c
+++ b/drivers/atmodem/sms.c
@@ -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;
diff --git a/drivers/atmodem/stk.c b/drivers/atmodem/stk.c
index bd4a7d21..fa8175a6 100644
--- a/drivers/atmodem/stk.c
+++ b/drivers/atmodem/stk.c
@@ -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",
diff --git a/drivers/atmodem/ussd.c b/drivers/atmodem/ussd.c
index f38dfd04..78f6004d 100644
--- a/drivers/atmodem/ussd.c
+++ b/drivers/atmodem/ussd.c
@@ -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;
diff --git a/drivers/atmodem/voicecall.c b/drivers/atmodem/voicecall.c
index 10b8f4b9..6f2ee9f5 100644
--- a/drivers/atmodem/voicecall.c
+++ b/drivers/atmodem/voicecall.c
@@ -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);