diff options
-rw-r--r-- | drivers/isimodem/ssn.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/isimodem/ssn.c b/drivers/isimodem/ssn.c index 402a48a5..747a8946 100644 --- a/drivers/isimodem/ssn.c +++ b/drivers/isimodem/ssn.c @@ -38,8 +38,7 @@ #include <ofono/ssn.h> #include "isimodem.h" - -#define PN_SS 0x06 +#include "ss.h" struct ssn_data { GIsiClient *client; @@ -48,17 +47,20 @@ struct ssn_data { static int isi_ssn_probe(struct ofono_ssn *ssn, unsigned int vendor, void *user) { - GIsiModem *idx = user; - struct ssn_data *data = g_try_new0(struct ssn_data, 1); + GIsiModem *modem = user; + struct ssn_data *sd; - if (data == NULL) + sd = g_try_new0(struct ssn_data, 1); + if (sd == NULL) return -ENOMEM; - data->client = g_isi_client_create(idx, PN_SS); - if (data->client == NULL) + sd->client = g_isi_client_create(modem, PN_SS); + if (sd->client == NULL) { + g_free(sd); return -ENOMEM; + } - ofono_ssn_set_data(ssn, data); + ofono_ssn_set_data(ssn, sd); return 0; } @@ -67,10 +69,11 @@ static void isi_ssn_remove(struct ofono_ssn *ssn) { struct ssn_data *data = ofono_ssn_get_data(ssn); + ofono_ssn_set_data(ssn, NULL); + if (data == NULL) return; - ofono_ssn_set_data(ssn, NULL); g_isi_client_destroy(data->client); g_free(data); } |