diff options
author | Aki Niemi <aki.niemi@nokia.com> | 2010-10-19 11:28:06 +0300 |
---|---|---|
committer | Aki Niemi <aki.niemi@nokia.com> | 2010-10-19 15:06:35 +0300 |
commit | 255782f8c2ff64991b362fb0e0554bd2adb7069e (patch) | |
tree | 86d891e0259255cc78f6344da69bbb33ad5a7b0c /drivers/isimodem/sim.c | |
parent | fd74feac0d7c5bbba4653b0b5c43c458c6874971 (diff) | |
download | ofono-255782f8c2ff64991b362fb0e0554bd2adb7069e.tar.bz2 |
isimodem: Fix request cleanup code
Adds a check for when the driver is being removed, in which case no
new ISI requests should be generated.
Diffstat (limited to 'drivers/isimodem/sim.c')
-rw-r--r-- | drivers/isimodem/sim.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/isimodem/sim.c b/drivers/isimodem/sim.c index d978c85d..d03a07e9 100644 --- a/drivers/isimodem/sim.c +++ b/drivers/isimodem/sim.c @@ -156,6 +156,9 @@ static gboolean isi_read_spn(struct ofono_sim *sim, struct isi_cb_data *cbd) 0 }; + if (!sd) + return FALSE; + return g_isi_request_make(sd->client, msg, sizeof(msg), SIM_TIMEOUT, spn_resp_cb, cbd) != NULL; } @@ -197,6 +200,9 @@ 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) + return FALSE; + return g_isi_request_make(sd->client, req, sizeof(req), SIM_TIMEOUT, read_iccid_resp_cb, cbd) != NULL; } @@ -337,11 +343,10 @@ static void isi_read_imsi(struct ofono_sim *sim, READ_IMSI }; - if (!cbd) + if (!cbd || !sd) goto error; - if (g_isi_request_make(sd->client, msg, sizeof(msg), - SIM_TIMEOUT, + if (g_isi_request_make(sd->client, msg, sizeof(msg), SIM_TIMEOUT, imsi_resp_cb, cbd)) return; |