From 67f78f680d4b72d24a280be528a00778dcdf28dc Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Sat, 27 Nov 2010 17:39:02 -0200 Subject: plugins: explicitly compare pointers to NULL This patch was generated by the following semantic patch (http://coccinelle.lip6.fr/) // @fix disable is_null,isnt_null1@ expression *E; @@ - !E + E == NULL // --- plugins/bluetooth.c | 6 +++--- plugins/calypso.c | 4 ++-- plugins/hfp.c | 20 ++++++++++---------- plugins/hso.c | 12 ++++++------ plugins/huawei.c | 10 +++++----- plugins/ifx.c | 24 ++++++++++++------------ plugins/isigen.c | 10 +++++----- plugins/mbm.c | 12 ++++++------ plugins/n900.c | 6 +++--- plugins/nokia-gpio.c | 6 +++--- plugins/nokia.c | 10 +++++----- plugins/novatel.c | 22 +++++++++++----------- plugins/palmpre.c | 10 +++++----- plugins/phonesim.c | 22 +++++++++++----------- plugins/smart-messaging.c | 4 ++-- plugins/ste.c | 12 ++++++------ plugins/udev.c | 4 ++-- plugins/wavecom.c | 8 ++++---- plugins/zte.c | 12 ++++++------ 19 files changed, 107 insertions(+), 107 deletions(-) (limited to 'plugins') diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c index 8e79b2e3..602c6da5 100644 --- a/plugins/bluetooth.c +++ b/plugins/bluetooth.c @@ -77,7 +77,7 @@ int bluetooth_send_with_reply(const char *path, const char *interface, msg = dbus_message_new_method_call(BLUEZ_SERVICE, path, interface, method); - if (!msg) { + if (msg == NULL) { ofono_error("Unable to allocate new D-Bus %s message", method); err = -ENOMEM; goto fail; @@ -271,7 +271,7 @@ static void device_properties_cb(DBusPendingCall *call, gpointer user_data) if ((have_uuid & HFP_AG) && device_addr && adapter_addr) { profile = g_hash_table_lookup(uuid_hash, HFP_AG_UUID); - if (!profile || !profile->create) + if (profile == NULL || profile->create == NULL) goto done; profile->create(path, device_addr, adapter_addr, alias); @@ -493,7 +493,7 @@ static void bluetooth_remove_all_modem(gpointer key, gpointer value, static void bluetooth_disconnect(DBusConnection *connection, void *user_data) { - if (!uuid_hash) + if (uuid_hash == NULL) return; g_hash_table_foreach(uuid_hash, bluetooth_remove_all_modem, NULL); diff --git a/plugins/calypso.c b/plugins/calypso.c index f787c7b6..0e29256a 100644 --- a/plugins/calypso.c +++ b/plugins/calypso.c @@ -170,7 +170,7 @@ static void simind_notify(GAtResult *result, gpointer user_data) struct calypso_data *data = ofono_modem_get_data(modem); GAtResultIter iter; - if (!data->sim) + if (data->sim == NULL) return; g_at_result_iter_init(&iter, result); @@ -257,7 +257,7 @@ static void mux_setup(GAtMux *mux, gpointer user_data) DBG("%p", mux); - if (!mux) { + if (mux == NULL) { ofono_modem_set_powered(modem, FALSE); return; } diff --git a/plugins/hfp.c b/plugins/hfp.c index 0a19dac4..d8d30b05 100644 --- a/plugins/hfp.c +++ b/plugins/hfp.c @@ -76,7 +76,7 @@ static void clear_data(struct ofono_modem *modem) { struct hfp_data *data = ofono_modem_get_data(modem); - if (!data->chat) + if (data->chat == NULL) return; g_at_chat_unref(data->chat); @@ -323,7 +323,7 @@ static int service_level_connection(struct ofono_modem *modem, int fd) char buf[64]; io = g_io_channel_unix_new(fd); - if (!io) { + if (io == NULL) { ofono_error("Service level connection failed: %s (%d)", strerror(errno), errno); return -EIO; @@ -334,7 +334,7 @@ static int service_level_connection(struct ofono_modem *modem, int fd) g_at_syntax_unref(syntax); g_io_channel_unref(io); - if (!chat) + if (chat == NULL) return -ENOMEM; g_at_chat_set_disconnect_function(chat, hfp_disconnected_cb, modem); @@ -415,7 +415,7 @@ static int hfp_create_modem(const char *device, const char *dev_addr, return -ENOMEM; data = g_try_new0(struct hfp_data, 1); - if (!data) + if (data == NULL) goto free; data->hf_features |= HF_FEATURE_3WAY; @@ -465,11 +465,11 @@ static void hfp_set_alias(const char *device, const char *alias) { struct ofono_modem *modem; - if (!device || !alias) + if (device == NULL || alias == NULL) return; modem = g_hash_table_lookup(modem_hash, device); - if (!modem) + if (modem == NULL) return; ofono_modem_set_name(modem, alias); @@ -485,7 +485,7 @@ static int hfp_register_ofono_handsfree(struct ofono_modem *modem) msg = dbus_message_new_method_call(BLUEZ_SERVICE, data->handsfree_path, BLUEZ_GATEWAY_INTERFACE, "RegisterAgent"); - if (!msg) + if (msg == NULL) return -ENOMEM; dbus_message_append_args(msg, DBUS_TYPE_OBJECT_PATH, &obj_path, @@ -505,7 +505,7 @@ static int hfp_unregister_ofono_handsfree(struct ofono_modem *modem) msg = dbus_message_new_method_call(BLUEZ_SERVICE, data->handsfree_path, BLUEZ_GATEWAY_INTERFACE, "UnregisterAgent"); - if (!msg) + if (msg == NULL) return -ENOMEM; dbus_message_append_args(msg, DBUS_TYPE_OBJECT_PATH, &obj_path, @@ -520,7 +520,7 @@ static int hfp_probe(struct ofono_modem *modem) const char *obj_path = ofono_modem_get_path(modem); struct hfp_data *data = ofono_modem_get_data(modem); - if (!data) + if (data == NULL) return -EINVAL; g_dbus_register_interface(connection, obj_path, HFP_AGENT_INTERFACE, @@ -573,7 +573,7 @@ static void hfp_connect_reply(DBusPendingCall *call, gpointer user_data) msg = dbus_message_new_method_call(BLUEZ_SERVICE, data->handsfree_path, BLUEZ_GATEWAY_INTERFACE, "Disconnect"); - if (!msg) + if (msg == NULL) ofono_error("Disconnect failed"); else g_dbus_send_message(connection, msg); diff --git a/plugins/hso.c b/plugins/hso.c index 055c63b3..e01ee870 100644 --- a/plugins/hso.c +++ b/plugins/hso.c @@ -63,7 +63,7 @@ static int hso_probe(struct ofono_modem *modem) DBG("%p", modem); data = g_try_new0(struct hso_data, 1); - if (!data) + if (data == NULL) return -ENOMEM; ofono_modem_set_data(modem, data); @@ -124,7 +124,7 @@ static GAtChat *create_port(const char *device) GAtChat *chat; channel = g_at_tty_open(device, NULL); - if (!channel) + if (channel == NULL) return NULL; syntax = g_at_syntax_new_gsm_permissive(); @@ -132,7 +132,7 @@ static GAtChat *create_port(const char *device) g_at_syntax_unref(syntax); g_io_channel_unref(channel); - if (!chat) + if (chat == NULL) return NULL; return chat; @@ -149,7 +149,7 @@ static int hso_enable(struct ofono_modem *modem) control = ofono_modem_get_string(modem, "ControlPort"); app = ofono_modem_get_string(modem, "ApplicationPort"); - if (!app || !control) + if (app == NULL || control == NULL) return -EINVAL; data->control = create_port(control); @@ -201,7 +201,7 @@ static int hso_disable(struct ofono_modem *modem) DBG("%p", modem); - if (!data->control) + if (data->control == NULL) return 0; g_at_chat_cancel_all(data->control); @@ -237,7 +237,7 @@ static void hso_set_online(struct ofono_modem *modem, ofono_bool_t online, DBG("modem %p %s", modem, online ? "online" : "offline"); - if (!cbd) + if (cbd == NULL) goto error; if (g_at_chat_send(chat, command, NULL, set_online_cb, cbd, g_free)) diff --git a/plugins/huawei.c b/plugins/huawei.c index e40a0ac0..25dfacaa 100644 --- a/plugins/huawei.c +++ b/plugins/huawei.c @@ -93,7 +93,7 @@ static int huawei_probe(struct ofono_modem *modem) DBG("%p", modem); data = g_try_new0(struct huawei_data, 1); - if (!data) + if (data == NULL) return -ENOMEM; ofono_modem_set_data(modem, data); @@ -392,7 +392,7 @@ static GAtChat *create_port(const char *device) GAtChat *chat; channel = g_at_tty_open(device, NULL); - if (!channel) + if (channel == NULL) return NULL; syntax = g_at_syntax_new_gsm_permissive(); @@ -400,7 +400,7 @@ static GAtChat *create_port(const char *device) g_at_syntax_unref(syntax); g_io_channel_unref(channel); - if (!chat) + if (chat == NULL) return NULL; return chat; @@ -533,7 +533,7 @@ static int huawei_disable(struct ofono_modem *modem) data->modem = NULL; } - if (!data->pcui) + if (data->pcui == NULL) return 0; g_at_chat_cancel_all(data->pcui); @@ -565,7 +565,7 @@ static void huawei_set_online(struct ofono_modem *modem, ofono_bool_t online, DBG("modem %p %s", modem, online ? "online" : "offline"); - if (!cbd) + if (cbd == NULL) goto error; if (g_at_chat_send(chat, command, NULL, set_online_cb, cbd, g_free)) diff --git a/plugins/ifx.c b/plugins/ifx.c index 037273ab..2f4c65b8 100644 --- a/plugins/ifx.c +++ b/plugins/ifx.c @@ -115,7 +115,7 @@ static int ifx_probe(struct ofono_modem *modem) DBG("%p", modem); data = g_try_new0(struct ifx_data, 1); - if (!data) + if (data == NULL) return -ENOMEM; data->mux_ldisc = -1; @@ -145,7 +145,7 @@ static void xsim_notify(GAtResult *result, gpointer user_data) GAtResultIter iter; int state; - if (!data->sim) + if (data->sim == NULL) return; g_at_result_iter_init(&iter, result); @@ -197,7 +197,7 @@ static void shutdown_device(struct ifx_data *data) } for (i = 0; i < NUM_DLC; i++) { - if (!data->dlcs[i]) + if (data->dlcs[i] == NULL) continue; g_at_chat_unref(data->dlcs[i]); @@ -239,7 +239,7 @@ static GAtChat *create_chat(GIOChannel *channel, struct ofono_modem *modem, GAtSyntax *syntax; GAtChat *chat; - if (!channel) + if (channel == NULL) return NULL; syntax = g_at_syntax_new_gsmv1(); @@ -247,7 +247,7 @@ static GAtChat *create_chat(GIOChannel *channel, struct ofono_modem *modem, g_at_syntax_unref(syntax); g_io_channel_unref(channel); - if (!chat) + if (chat == NULL) return NULL; if (getenv("OFONO_AT_DEBUG")) @@ -408,7 +408,7 @@ static gboolean dlc_ready_check(gpointer user_data) GIOChannel *channel = g_at_tty_open(dlc_nodes[i], NULL); data->dlcs[i] = create_chat(channel, modem, dlc_prefixes[i]); - if (!data->dlcs[i]) { + if (data->dlcs[i] == NULL) { ofono_error("Failed to open %s", dlc_nodes[i]); goto error; } @@ -445,7 +445,7 @@ static void setup_internal_mux(struct ofono_modem *modem) g_io_channel_set_buffered(data->device, FALSE); data->mux = g_at_mux_new_gsm0710_basic(data->device, data->frame_size); - if (!data->mux) + if (data->mux == NULL) goto error; if (getenv("OFONO_MUX_DEBUG")) @@ -457,7 +457,7 @@ static void setup_internal_mux(struct ofono_modem *modem) GIOChannel *channel = g_at_mux_create_channel(data->mux); data->dlcs[i] = create_chat(channel, modem, dlc_prefixes[i]); - if (!data->dlcs[i]) { + if (data->dlcs[i] == NULL) { ofono_error("Failed to create channel"); goto error; } @@ -580,14 +580,14 @@ static int ifx_enable(struct ofono_modem *modem) } data->device = g_at_tty_open(device, NULL); - if (!data->device) + if (data->device == NULL) return -EIO; syntax = g_at_syntax_new_gsmv1(); chat = g_at_chat_new(data->device, syntax); g_at_syntax_unref(syntax); - if (!chat) { + if (chat == NULL) { g_io_channel_unref(data->device); return -EIO; } @@ -667,7 +667,7 @@ static void ifx_set_online(struct ofono_modem *modem, ofono_bool_t online, DBG("%p %s", modem, online ? "online" : "offline"); - if (!cbd) + if (cbd == NULL) goto error; if (g_at_chat_send(data->dlcs[AUX_DLC], command, NULL, @@ -736,7 +736,7 @@ static void ifx_post_online(struct ofono_modem *modem) gprs = ofono_gprs_create(modem, OFONO_VENDOR_IFX, "atmodem", data->dlcs[NETREG_DLC]); - if (!gprs) + if (gprs == NULL) return; if (data->mux_ldisc < 0) { diff --git a/plugins/isigen.c b/plugins/isigen.c index 3384e9f2..028f1b22 100644 --- a/plugins/isigen.c +++ b/plugins/isigen.c @@ -282,7 +282,7 @@ static int isigen_probe(struct ofono_modem *modem) } link = g_pn_netlink_start(idx, phonet_status_cb, modem); - if (!link) { + if (link == NULL) { DBG("%s: %s", ifname, strerror(errno)); return -errno; } @@ -315,7 +315,7 @@ static void isigen_remove(struct ofono_modem *modem) { struct isi_data *isi = ofono_modem_get_data(modem); - if (!isi) + if (isi == NULL) return; ofono_modem_set_data(modem, NULL); @@ -370,7 +370,7 @@ static void isigen_online(struct ofono_modem *modem, ofono_bool_t online, DBG("(%p) with %s", modem, isi->ifname); - if (!cbd) + if (cbd == NULL) goto error; isi->online = online; @@ -425,13 +425,13 @@ static void isigen_post_online(struct ofono_modem *modem) ofono_radio_settings_create(isi->modem, 0, "isimodem", isi->idx); gprs = ofono_gprs_create(isi->modem, 0, "isimodem", isi->idx); - if (!gprs) + if (gprs == NULL) return; for (i = 0; i < ISI_DEFAULT_PDPS; i++) { gc = ofono_gprs_context_create(isi->modem, 0, "isimodem", isi->idx); - if (!gc) { + if (gc == NULL) { DBG("Failed to add context %d", i); break; } diff --git a/plugins/mbm.c b/plugins/mbm.c index 35b85ea1..62e3ae1e 100644 --- a/plugins/mbm.c +++ b/plugins/mbm.c @@ -77,7 +77,7 @@ static int mbm_probe(struct ofono_modem *modem) DBG("%p", modem); data = g_try_new0(struct mbm_data, 1); - if (!data) + if (data == NULL) return -ENOMEM; ofono_modem_set_data(modem, data); @@ -283,7 +283,7 @@ static GAtChat *create_port(const char *device) GAtChat *chat; channel = g_at_tty_open(device, NULL); - if (!channel) + if (channel == NULL) return NULL; syntax = g_at_syntax_new_gsm_permissive(); @@ -291,7 +291,7 @@ static GAtChat *create_port(const char *device) g_at_syntax_unref(syntax); g_io_channel_unref(channel); - if (!chat) + if (chat == NULL) return NULL; return chat; @@ -430,7 +430,7 @@ static int mbm_disable(struct ofono_modem *modem) data->reopen_source = 0; } - if (!data->modem_port) + if (data->modem_port == NULL) return 0; g_at_chat_cancel_all(data->modem_port); @@ -462,7 +462,7 @@ static void mbm_set_online(struct ofono_modem *modem, ofono_bool_t online, DBG("modem %p %s", modem, online ? "online" : "offline"); - if (!cbd) + if (cbd == NULL) goto error; if (g_at_chat_send(chat, command, NULL, set_online_cb, cbd, g_free)) @@ -523,7 +523,7 @@ static void mbm_post_online(struct ofono_modem *modem) data->gprs = ofono_gprs_create(modem, OFONO_VENDOR_MBM, "atmodem", data->modem_port); - if (!data->gprs) + if (data->gprs == NULL) return; gc = ofono_gprs_context_create(modem, 0, diff --git a/plugins/n900.c b/plugins/n900.c index a9e6b59f..76198219 100644 --- a/plugins/n900.c +++ b/plugins/n900.c @@ -398,7 +398,7 @@ static int n900_probe(struct ofono_modem *modem) DBG("(%p) with %s", modem, ifname); idx = g_isi_modem_by_name(ifname); - if (!idx) { + if (idx == NULL) { DBG("Interface=%s: %s", ifname, strerror(errno)); return -errno; } @@ -409,7 +409,7 @@ static int n900_probe(struct ofono_modem *modem) } isi = g_new0(struct isi_data, 1); - if (!isi) { + if (isi == NULL) { gpio_remove(modem); return -ENOMEM; } @@ -451,7 +451,7 @@ static void n900_set_online(struct ofono_modem *modem, DBG("(%p) with %s", modem, isi->ifname); - if (!cbd) + if (cbd == NULL) goto error; if (isi->power_state != POWER_STATE_ON) diff --git a/plugins/nokia-gpio.c b/plugins/nokia-gpio.c index f3b94607..db0aa396 100644 --- a/plugins/nokia-gpio.c +++ b/plugins/nokia-gpio.c @@ -155,7 +155,7 @@ static int file_write(char const *filename, char const *output) FILE *f; f = fopen(filename, "r+"); - if (!f) { + if (f == NULL) { DBG("%s: %s (%d)", filename, strerror(errno), errno); return -1; } @@ -709,7 +709,7 @@ int gpio_probe(GIsiModem *idx, unsigned addr, gpio_finished_cb_t cb, void *data) { int error; - if (!cb) { + if (cb == NULL) { DBG("gpio: No callback given"); return -(errno = EFAULT); } @@ -754,7 +754,7 @@ int gpio_probe(GIsiModem *idx, unsigned addr, gpio_finished_cb_t cb, void *data) self.rapu = RAPU_TYPE_2; self.link = g_pn_netlink_start(idx, phonet_status_cb, NULL); - if (!self.link) { + if (self.link == NULL) { memset(&self, 0, sizeof self); return -errno; } diff --git a/plugins/nokia.c b/plugins/nokia.c index bb8e2f38..6f857943 100644 --- a/plugins/nokia.c +++ b/plugins/nokia.c @@ -62,7 +62,7 @@ static int nokia_probe(struct ofono_modem *modem) DBG("%p", modem); data = g_try_new0(struct nokia_data, 1); - if (!data) + if (data == NULL) return -ENOMEM; ofono_modem_set_data(modem, data); @@ -106,7 +106,7 @@ static GAtChat *open_device(struct ofono_modem *modem, DBG("%s %s", key, device); channel = g_at_tty_open(device, NULL); - if (!channel) + if (channel == NULL) return NULL; syntax = g_at_syntax_new_gsm_permissive(); @@ -114,7 +114,7 @@ static GAtChat *open_device(struct ofono_modem *modem, g_at_syntax_unref(syntax); g_io_channel_unref(channel); - if (!chat) + if (chat == NULL) return NULL; if (getenv("OFONO_AT_DEBUG")) @@ -137,7 +137,7 @@ static void nokia_disconnect(gpointer user_data) data->modem = NULL; data->modem = open_device(modem, "Modem", "Modem: "); - if (!data->modem) + if (data->modem == NULL) return; g_at_chat_set_disconnect_function(data->modem, @@ -216,7 +216,7 @@ static int nokia_disable(struct ofono_modem *modem) data->modem = NULL; } - if (!data->control) + if (data->control == NULL) return 0; g_at_chat_cancel_all(data->control); diff --git a/plugins/novatel.c b/plugins/novatel.c index 4a3802e8..578cec13 100644 --- a/plugins/novatel.c +++ b/plugins/novatel.c @@ -66,7 +66,7 @@ static int novatel_probe(struct ofono_modem *modem) DBG("%p", modem); data = g_try_new0(struct novatel_data, 1); - if (!data) + if (data == NULL) return -ENOMEM; ofono_modem_set_data(modem, data); @@ -102,11 +102,11 @@ static GAtChat *open_device(struct ofono_modem *modem, const char *device; device = ofono_modem_get_string(modem, key); - if (!device) + if (device == NULL) return NULL; channel = g_at_tty_open(device, NULL); - if (!channel) + if (channel == NULL) return NULL; syntax = g_at_syntax_new_gsm_permissive(); @@ -114,7 +114,7 @@ static GAtChat *open_device(struct ofono_modem *modem, g_at_syntax_unref(syntax); g_io_channel_unref(channel); - if (!chat) + if (chat == NULL) return NULL; if (getenv("OFONO_AT_DEBUG")) @@ -146,7 +146,7 @@ static void nwdmat_action(gboolean ok, GAtResult *result, gpointer user_data) data->dmat_mode = 1; data->secondary = open_device(modem, "SecondaryDevice", "Control: "); - if (!data->secondary) + if (data->secondary == NULL) goto done; g_at_chat_send(data->secondary, "ATE0 +CMEE=1", none_prefix, @@ -208,7 +208,7 @@ static void novatel_disconnect(gpointer user_data) data->primary = NULL; data->primary = open_device(modem, "PrimaryDevice", "Modem: "); - if (!data->primary) + if (data->primary == NULL) return; g_at_chat_set_disconnect_function(data->primary, @@ -230,7 +230,7 @@ static int novatel_enable(struct ofono_modem *modem) DBG("%p", modem); data->primary = open_device(modem, "PrimaryDevice", "Modem: "); - if (!data->primary) + if (data->primary == NULL) return -EIO; g_at_chat_set_disconnect_function(data->primary, @@ -266,7 +266,7 @@ static int novatel_disable(struct ofono_modem *modem) DBG("%p", modem); - if (!data->primary) + if (data->primary == NULL) return 0; if (data->secondary) { @@ -310,7 +310,7 @@ static void novatel_set_online(struct ofono_modem *modem, ofono_bool_t online, DBG("modem %p %s", modem, online ? "online" : "offline"); - if (!cbd || !chat) + if (cbd == NULL || chat == NULL) goto error; if (g_at_chat_send(chat, command, NULL, set_online_cb, cbd, g_free)) @@ -329,7 +329,7 @@ static void novatel_pre_sim(struct ofono_modem *modem) DBG("%p", modem); - if (!data->secondary) { + if (data->secondary == NULL) { ofono_devinfo_create(modem, 0, "atmodem", data->primary); sim = ofono_sim_create(modem, OFONO_VENDOR_QUALCOMM_MSM, "atmodem", data->primary); @@ -349,7 +349,7 @@ static void novatel_post_online(struct ofono_modem *modem) DBG("%p", modem); - if (!data->secondary) { + if (data->secondary == NULL) { ofono_netreg_create(modem, OFONO_VENDOR_NOVATEL, "atmodem", data->primary); diff --git a/plugins/palmpre.c b/plugins/palmpre.c index 17148637..9555871c 100644 --- a/plugins/palmpre.c +++ b/plugins/palmpre.c @@ -57,7 +57,7 @@ static int palmpre_probe(struct ofono_modem *modem) DBG("%p", modem); data = g_try_new0(struct palmpre_data, 1); - if (!data) + if (data == NULL) return -ENOMEM; ofono_modem_set_data(modem, data); @@ -104,11 +104,11 @@ static int palmpre_enable(struct ofono_modem *modem) DBG("%p", modem); device = ofono_modem_get_string(modem, "Device"); - if (!device) + if (device == NULL) device = "/dev/modem0"; options = g_hash_table_new(g_str_hash, g_str_equal); - if (!options) + if (options == NULL) return -ENOMEM; g_hash_table_insert(options, "Baud", "115200"); @@ -116,7 +116,7 @@ static int palmpre_enable(struct ofono_modem *modem) io = g_at_tty_open(device, options); g_hash_table_destroy(options); - if (!io) + if (io == NULL) return -EIO; syntax = g_at_syntax_new_gsm_permissive(); @@ -124,7 +124,7 @@ static int palmpre_enable(struct ofono_modem *modem) g_io_channel_unref(io); g_at_syntax_unref(syntax); - if (!data->chat) + if (data->chat == NULL) return -ENOMEM; if (getenv("OFONO_AT_DEBUG")) diff --git a/plugins/phonesim.c b/plugins/phonesim.c index d10eda82..6b483ff6 100644 --- a/plugins/phonesim.c +++ b/plugins/phonesim.c @@ -143,7 +143,7 @@ static void phonesim_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; @@ -167,7 +167,7 @@ static int phonesim_context_probe(struct ofono_gprs_context *gc, struct gprs_context_data *gcd; gcd = g_try_new0(struct gprs_context_data, 1); - if (!gcd) + if (gcd == NULL) return -ENOMEM; gcd->chat = g_at_chat_clone(chat); @@ -342,7 +342,7 @@ static int phonesim_probe(struct ofono_modem *modem) DBG("%p", modem); data = g_try_new0(struct phonesim_data, 1); - if (!data) + if (data == NULL) return -ENOMEM; ofono_modem_set_data(modem, data); @@ -402,7 +402,7 @@ static void mux_setup(GAtMux *mux, gpointer user_data) DBG("%p", mux); - if (!mux) { + if (mux == NULL) { ofono_modem_set_powered(modem, FALSE); return; } @@ -448,7 +448,7 @@ static int phonesim_enable(struct ofono_modem *modem) DBG("%p", modem); address = ofono_modem_get_string(modem, "Address"); - if (!address) + if (address == NULL) return -EINVAL; port = ofono_modem_get_integer(modem, "Port"); @@ -479,7 +479,7 @@ static int phonesim_enable(struct ofono_modem *modem) } io = g_io_channel_unix_new(sk); - if (!io) { + if (io == NULL) { close(sk); return -ENOMEM; } @@ -494,7 +494,7 @@ static int phonesim_enable(struct ofono_modem *modem) g_at_syntax_unref(syntax); g_io_channel_unref(io); - if (!data->chat) + if (data->chat == NULL) return -ENOMEM; if (getenv("OFONO_AT_DEBUG")) @@ -676,18 +676,18 @@ static struct ofono_modem *create_modem(GKeyFile *keyfile, const char *group) DBG("group %s", group); modem = ofono_modem_create(group, "phonesim"); - if (!modem) + if (modem == NULL) return NULL; value = g_key_file_get_string(keyfile, group, "Address", NULL); - if (!value) + if (value == NULL) goto error; ofono_modem_set_string(modem, "Address", value); g_free(value); value = g_key_file_get_string(keyfile, group, "Port", NULL); - if (!value) + if (value == NULL) goto error; ofono_modem_set_integer(modem, "Port", atoi(value)); @@ -744,7 +744,7 @@ static void parse_config(const char *filename) struct ofono_modem *modem; modem = create_modem(keyfile, modems[i]); - if (!modem) + if (modem == NULL) continue; modem_list = g_slist_prepend(modem_list, modem); diff --git a/plugins/smart-messaging.c b/plugins/smart-messaging.c index e9437969..e7889f26 100644 --- a/plugins/smart-messaging.c +++ b/plugins/smart-messaging.c @@ -207,7 +207,7 @@ static DBusMessage *smart_messaging_send_vcard(DBusConnection *conn, msg_list = sms_datagram_prepare(to, bytes, len, ref, use_16bit_ref, 0, VCARD_DST_PORT, TRUE, FALSE); - if (!msg_list) + if (msg_list == NULL) return __ofono_error_invalid_format(msg); flags = OFONO_SMS_SUBMIT_FLAG_RETRY | OFONO_SMS_SUBMIT_FLAG_EXPOSE_DBUS; @@ -250,7 +250,7 @@ static DBusMessage *smart_messaging_send_vcal(DBusConnection *conn, msg_list = sms_datagram_prepare(to, bytes, len, ref, use_16bit_ref, 0, VCAL_DST_PORT, TRUE, FALSE); - if (!msg_list) + if (msg_list == NULL) return __ofono_error_invalid_format(msg); flags = OFONO_SMS_SUBMIT_FLAG_RETRY | OFONO_SMS_SUBMIT_FLAG_EXPOSE_DBUS; diff --git a/plugins/ste.c b/plugins/ste.c index 508ad587..ecdc326f 100644 --- a/plugins/ste.c +++ b/plugins/ste.c @@ -80,7 +80,7 @@ static int ste_probe(struct ofono_modem *modem) DBG("%p", modem); data = g_try_new0(struct ste_data, 1); - if (!data) + if (data == NULL) return -ENOMEM; ofono_modem_set_data(modem, data); @@ -173,7 +173,7 @@ static int ste_enable(struct ofono_modem *modem) DBG("%p", modem); device = ofono_modem_get_string(modem, "Device"); - if (!device) { + if (device == NULL) { struct sockaddr_caif addr; int err; const char *interface; @@ -221,7 +221,7 @@ static int ste_enable(struct ofono_modem *modem) } channel = g_io_channel_unix_new(fd); - if (!channel) { + if (channel == NULL) { close(fd); return -EIO; } @@ -233,7 +233,7 @@ static int ste_enable(struct ofono_modem *modem) g_at_syntax_unref(syntax); g_io_channel_unref(channel); - if (!data->chat) + if (data->chat == NULL) return -ENOMEM; if (getenv("OFONO_AT_DEBUG")) @@ -266,7 +266,7 @@ static int ste_disable(struct ofono_modem *modem) DBG("%p", modem); - if (!data->chat) + if (data->chat == NULL) return 0; g_at_chat_cancel_all(data->chat); @@ -298,7 +298,7 @@ static void ste_set_online(struct ofono_modem *modem, ofono_bool_t online, DBG("modem %p %s", modem, online ? "online" : "offline"); - if (!cbd) + if (cbd == NULL) goto error; if (g_at_chat_send(chat, command, NULL, set_online_cb, cbd, g_free)) diff --git a/plugins/udev.c b/plugins/udev.c index 737a6370..255755e2 100644 --- a/plugins/udev.c +++ b/plugins/udev.c @@ -555,7 +555,7 @@ static void remove_modem(struct udev_device *udev_device) DBG("%s", curpath); devpath = g_hash_table_lookup(devpath_list, curpath); - if (!devpath) + if (devpath == NULL) return; modem = find_modem(devpath); @@ -681,7 +681,7 @@ static int udev_init(void) { devpath_list = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - if (!devpath_list) { + if (devpath_list == NULL) { ofono_error("Failed to create udev path list"); return -ENOMEM; } diff --git a/plugins/wavecom.c b/plugins/wavecom.c index 73fa502c..cb55f850 100644 --- a/plugins/wavecom.c +++ b/plugins/wavecom.c @@ -78,12 +78,12 @@ static int wavecom_enable(struct ofono_modem *modem) DBG("%p", modem); device = ofono_modem_get_string(modem, "Device"); - if (!device) + if (device == NULL) return -EINVAL; options = g_hash_table_new(g_str_hash, g_str_equal); - if (!options) + if (options == NULL) return -ENOMEM; g_hash_table_insert(options, "Baud", "115200"); @@ -95,7 +95,7 @@ static int wavecom_enable(struct ofono_modem *modem) g_hash_table_destroy(options); - if (!channel) + if (channel == NULL) return -EIO; /* @@ -108,7 +108,7 @@ static int wavecom_enable(struct ofono_modem *modem) g_at_syntax_unref(syntax); g_io_channel_unref(channel); - if (!chat) + if (chat == NULL) return -ENOMEM; if (getenv("OFONO_AT_DEBUG")) diff --git a/plugins/zte.c b/plugins/zte.c index 83602ebf..82f322a2 100644 --- a/plugins/zte.c +++ b/plugins/zte.c @@ -64,7 +64,7 @@ static int zte_probe(struct ofono_modem *modem) DBG("%p", modem); data = g_try_new0(struct zte_data, 1); - if (!data) + if (data == NULL) return -ENOMEM; ofono_modem_set_data(modem, data); @@ -108,7 +108,7 @@ static GAtChat *open_device(struct ofono_modem *modem, DBG("%s %s", key, device); channel = g_at_tty_open(device, NULL); - if (!channel) + if (channel == NULL) return NULL; syntax = g_at_syntax_new_gsm_permissive(); @@ -116,7 +116,7 @@ static GAtChat *open_device(struct ofono_modem *modem, g_at_syntax_unref(syntax); g_io_channel_unref(channel); - if (!chat) + if (chat == NULL) return NULL; if (getenv("OFONO_AT_DEBUG")) @@ -138,7 +138,7 @@ static void zte_disconnect(gpointer user_data) data->modem = NULL; data->modem = open_device(modem, "Modem", "Modem: "); - if (!data->modem) + if (data->modem == NULL) return; g_at_chat_set_disconnect_function(data->modem, @@ -218,7 +218,7 @@ static int zte_disable(struct ofono_modem *modem) data->modem = NULL; } - if (!data->aux) + if (data->aux == NULL) return 0; g_at_chat_cancel_all(data->aux); @@ -250,7 +250,7 @@ static void zte_set_online(struct ofono_modem *modem, ofono_bool_t online, DBG("modem %p %s", modem, online ? "online" : "offline"); - if (!cbd || !chat) + if (cbd == NULL || chat == NULL) goto error; if (g_at_chat_send(chat, command, NULL, set_online_cb, cbd, g_free)) -- cgit v1.2.3