From ff7e062e94fb779cae18be33d8d81f888033c98a Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Wed, 24 Aug 2022 13:51:12 +0000 Subject: [PATCH] mtk: fix task completion when loading supported modes --- plugins/mtk/mm-broadband-modem-mtk.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/plugins/mtk/mm-broadband-modem-mtk.c b/plugins/mtk/mm-broadband-modem-mtk.c index 131f8daa..0ceca795 100644 --- a/plugins/mtk/mm-broadband-modem-mtk.c +++ b/plugins/mtk/mm-broadband-modem-mtk.c @@ -199,14 +199,12 @@ get_supported_modes_ready (MMBaseModem *self, g_assert (r != NULL); if (!g_regex_match_full (r, response, strlen (response), 0, 0, &match_info, &match_error)) { - if (match_error) { - g_propagate_error (&error, match_error); - } else { - g_set_error (&error, - MM_CORE_ERROR, - MM_CORE_ERROR_FAILED, - "Failed to match EGMR response: %s", response); - } + if (match_error) + g_task_return_error (task, error); + else + g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_FAILED, + "Failed to match EGMR response: %s", response); + g_object_unref (task); g_match_info_free (match_info); g_regex_unref (r); @@ -214,11 +212,10 @@ get_supported_modes_ready (MMBaseModem *self, } if (!mm_get_int_from_match_info (match_info, 1, &device_type)) { - g_set_error (&error, - MM_CORE_ERROR, - MM_CORE_ERROR_FAILED, - "Failed to parse the allowed mode response: '%s'", - response); + g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_FAILED, + "Failed to parse the allowed mode response: '%s'", + response); + g_object_unref (task); g_regex_unref (r); g_match_info_free (match_info);