summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorJonas Bonn <jonas@norrbonn.se>2019-09-25 06:35:06 +0200
committerDenis Kenzior <denkenz@gmail.com>2019-09-25 21:25:16 -0500
commit0b3c64097152eb72935fabdef6c22939043729fe (patch)
treefabb679f95b161190657275a512c2cfe171a96e6 /plugins
parent4bf76718817cd2fe68a37d5edf72d8d6983d9672 (diff)
downloadofono-0b3c64097152eb72935fabdef6c22939043729fe.tar.gz
ublox: use common close_devices when modem disabled
Just reshuffling the code a bit and the 'disable' path can use the close_devices() helper to finish up. This also prevents a bug should the CFUN command fail to disable the modem whereby the 'aux' device remains open but the 'modem' device has already been closed.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/ublox.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/plugins/ublox.c b/plugins/ublox.c
index 60a734ce..22350462 100644
--- a/plugins/ublox.c
+++ b/plugins/ublox.c
@@ -269,15 +269,15 @@ static int ublox_enable(struct ofono_modem *modem)
static void cfun_disable(gboolean ok, GAtResult *result, gpointer user_data)
{
struct ofono_modem *modem = user_data;
- struct ublox_data *data = ofono_modem_get_data(modem);
DBG("");
- g_at_chat_unref(data->aux);
- data->aux = NULL;
+ if (!ok) {
+ ofono_error("Failed to disable modem");
+ return;
+ }
- if (ok)
- ofono_modem_set_powered(modem, FALSE);
+ close_devices(modem);
}
static int ublox_disable(struct ofono_modem *modem)
@@ -288,8 +288,6 @@ static int ublox_disable(struct ofono_modem *modem)
g_at_chat_cancel_all(data->modem);
g_at_chat_unregister_all(data->modem);
- g_at_chat_unref(data->modem);
- data->modem = NULL;
g_at_chat_cancel_all(data->aux);
g_at_chat_unregister_all(data->aux);