plugins: 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:
Lucas De Marchi 2010-11-27 17:39:02 -02:00 committed by Denis Kenzior
parent 521071a785
commit 67f78f680d
19 changed files with 107 additions and 107 deletions

View File

@ -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);

View File

@ -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;
}

View File

@ -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);

View File

@ -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))

View File

@ -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))

View File

@ -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) {

View File

@ -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;
}

View File

@ -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,

View File

@ -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)

View File

@ -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;
}

View File

@ -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);

View File

@ -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);

View File

@ -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"))

View File

@ -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);

View File

@ -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;

View File

@ -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))

View File

@ -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;
}

View File

@ -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"))

View File

@ -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))