[PATCH] telit: fix modem_set_current_bands to use g_task_report_new_error
Ben Chan
benchan at chromium.org
Tue Jul 18 00:04:56 UTC 2017
Commit acf101335 ("telit: port mm-broadband-modem-telit to use GTask")
ported most of the modem_set_current_bands code to use GTask, but missed
a few g_simple_async_report_error_in_idle calls, which potentially leads
to an incorrect G_TASK cast in modem_set_current_bands_finish.
---
plugins/telit/mm-broadband-modem-telit.c | 51 +++++++++++++++++---------------
1 file changed, 27 insertions(+), 24 deletions(-)
diff --git a/plugins/telit/mm-broadband-modem-telit.c b/plugins/telit/mm-broadband-modem-telit.c
index a8ee886c..513d75bc 100644
--- a/plugins/telit/mm-broadband-modem-telit.c
+++ b/plugins/telit/mm-broadband-modem-telit.c
@@ -360,32 +360,35 @@ modem_set_current_bands (MMIfaceModem *self,
is_4g = mm_iface_modem_is_4g (self);
if (is_2g && flag2g == -1) {
- g_simple_async_report_error_in_idle (G_OBJECT (self),
- callback,
- user_data,
- MM_CORE_ERROR,
- MM_CORE_ERROR_NOT_FOUND,
- "None or invalid 2G bands combination in the provided list");
+ g_task_report_new_error (self,
+ callback,
+ user_data,
+ modem_set_current_bands,
+ MM_CORE_ERROR,
+ MM_CORE_ERROR_NOT_FOUND,
+ "None or invalid 2G bands combination in the provided list");
return;
}
if (is_3g && flag3g == -1) {
- g_simple_async_report_error_in_idle (G_OBJECT (self),
- callback,
- user_data,
- MM_CORE_ERROR,
- MM_CORE_ERROR_NOT_FOUND,
- "None or invalid 3G bands combination in the provided list");
+ g_task_report_new_error (self,
+ callback,
+ user_data,
+ modem_set_current_bands,
+ MM_CORE_ERROR,
+ MM_CORE_ERROR_NOT_FOUND,
+ "None or invalid 3G bands combination in the provided list");
return;
}
if (is_4g && flag4g == -1) {
- g_simple_async_report_error_in_idle (G_OBJECT (self),
- callback,
- user_data,
- MM_CORE_ERROR,
- MM_CORE_ERROR_NOT_FOUND,
- "None or invalid 4G bands combination in the provided list");
+ g_task_report_new_error (self,
+ callback,
+ user_data,
+ modem_set_current_bands,
+ MM_CORE_ERROR,
+ MM_CORE_ERROR_NOT_FOUND,
+ "None or invalid 4G bands combination in the provided list");
return;
}
@@ -403,12 +406,12 @@ modem_set_current_bands (MMIfaceModem *self,
else if (is_2g && !is_3g && is_4g)
cmd = g_strdup_printf ("AT#BND=%d,0,%d", flag2g, flag4g);
else {
- g_simple_async_report_error_in_idle (G_OBJECT (self),
- callback,
- user_data,
- MM_CORE_ERROR,
- MM_CORE_ERROR_FAILED,
- "Unexpectd error: could not compose AT#BND command");
+ g_task_report_new_error (self,
+ callback,
+ user_data,
+ MM_CORE_ERROR,
+ MM_CORE_ERROR_FAILED,
+ "Unexpectd error: could not compose AT#BND command");
return;
}
task = g_task_new (self, NULL, callback, user_data);
--
2.13.2.932.g7449e964c-goog
More information about the ModemManager-devel
mailing list