summaryrefslogtreecommitdiffstats
path: root/drivers/mbmmodem/stk.c
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2010-05-12 13:36:07 -0500
committerDenis Kenzior <denkenz@gmail.com>2010-05-12 13:44:31 -0500
commitf98c6dc91702c0d14c0afa2a4e32102d3105568d (patch)
tree25fc718bc71ec69c22afb2a50da4f0549fec6676 /drivers/mbmmodem/stk.c
parent49c5def68bf2dfe03f9c785757445e620b3c0043 (diff)
downloadofono-f98c6dc91702c0d14c0afa2a4e32102d3105568d.tar.bz2
mbm: Simplify STKE logic
We shouldn't use CALLBACK_WITH_FAILURE unless we can't parse the response from the modem. This most likely indicates an integration error.
Diffstat (limited to 'drivers/mbmmodem/stk.c')
-rw-r--r--drivers/mbmmodem/stk.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/mbmmodem/stk.c b/drivers/mbmmodem/stk.c
index f63370c7..912f63dd 100644
--- a/drivers/mbmmodem/stk.c
+++ b/drivers/mbmmodem/stk.c
@@ -52,18 +52,23 @@ static void mbm_stke_cb(gboolean ok, GAtResult *result, gpointer user_data)
ofono_stk_envelope_cb_t cb = cbd->cb;
GAtResultIter iter;
struct ofono_error error;
- const guint8 *pdu = { 0 };
- gint len = 0;
+ const guint8 *pdu;
+ gint len;
decode_at_error(&error, g_at_result_final_response(result));
- if (!ok)
- goto error;
+ if (!ok) {
+ cb(&error, NULL, 0, cbd->data);
+ return;
+ }
g_at_result_iter_init(&iter, result);
- if (g_at_result_iter_next(&iter, "*STKE:"))
- g_at_result_iter_next_hexstring(&iter, &pdu, &len);
+ if (g_at_result_iter_next(&iter, "*STKE:") == FALSE)
+ goto error;
+
+ if (g_at_result_iter_next_hexstring(&iter, &pdu, &len) == FALSE)
+ goto error;
cb(&error, pdu, len, cbd->data);
return;