aboutsummaryrefslogtreecommitdiff
path: root/src/mm-iface-modem-firmware.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2017-10-20 17:47:54 +0200
committerAleksander Morgado <aleksander@aleksander.es>2017-10-20 17:56:36 +0200
commitadcce66dd7b676e4cc7bf71b63588e746f51dc14 (patch)
tree6cdd46aaa2cf7b8e2463e6d5fd6d5b24e2a569bf /src/mm-iface-modem-firmware.c
parentdbb4597e335d66dda7abebbab7d70b0708146350 (diff)
broadband-modem-qmi: avoid NULL success return in firmware_load_current
Instead of assuming that NULL is a valid return, make sure we return an error instead. This also makes it sure that if the GTask gets cancelled, the result we set is always a valid GObject, so that the g_object_unref passed as GDestroyNotify can be safely called always. Not a big deal anyway, as the GTask cannot be currently cancelled.
Diffstat (limited to 'src/mm-iface-modem-firmware.c')
-rw-r--r--src/mm-iface-modem-firmware.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/mm-iface-modem-firmware.c b/src/mm-iface-modem-firmware.c
index da106b00..0646f376 100644
--- a/src/mm-iface-modem-firmware.c
+++ b/src/mm-iface-modem-firmware.c
@@ -68,12 +68,16 @@ load_current_ready (MMIfaceModemFirmware *self,
GList *l;
GError *error = NULL;
- /* reported current may be NULL and we don't treat it as error */
ctx->current = MM_IFACE_MODEM_FIRMWARE_GET_INTERFACE (self)->load_current_finish (self, res, &error);
- if (error) {
- g_dbus_method_invocation_take_error (ctx->invocation, error);
- handle_list_context_free (ctx);
- return;
+ if (!ctx->current) {
+ /* Not found isn't fatal */
+ if (!g_error_matches (error, MM_CORE_ERROR, MM_CORE_ERROR_NOT_FOUND)) {
+ g_dbus_method_invocation_take_error (ctx->invocation, error);
+ handle_list_context_free (ctx);
+ return;
+ }
+ mm_dbg ("Couldn't load current firmware image: %s", error->message);
+ g_clear_error (&error);
}
/* Build array of dicts */