When porting MMSmsMbim to use GTask, peek_device wasn't modified to use
g_task_report_new_error, which could potentially lead to an incorrect
G_TASK cast.
Commit 7c5f308af ("iface-modem-time: port update_network_timezone to use
GTask") ported most of the update_network_timezone code to use GTask,
but missed a g_simple_async_report_error_in_idle call, which could
potentially lead to an incorrect G_TASK cast.
Commit a08064492 ("call-list: port mm_call_list_delete_call to use GTask")
ported most of the mm_call_list_delete_call code to use GTask, but missed a
g_simple_async_report_error_in_idle calls, which can potentially lead to
an incorrect G_TASK cast in mm_call_list_delete_call_finish.
All MMIfaceModem functions implemented by MMBroadbandModem, except
load_power_state, are prefixed with 'modem_'. For consistency, this
patch renames load_power_state{,_finish} to
modem_load_power_state{,_finish}.
If an MBIM modem supports unsolicited notifications for
subscriber ready status, we can use it to detect when SIM cards
have been removed and reinserted. Upon detection we should re-
probe the modem so that we can configure it for the new SIM.
This fixes commit 66f10d61a2
("iface-modem: port mm_iface_modem_initialize to use GTask"), which
didn't update mm_iface_modem_initialize_finish to use
g_task_propagate_boolean.
CC ModemManager-mm-broadband-modem-mbim.o
mm-broadband-modem-mbim.c: In function ‘mbim_port_open_ready’:
mm-broadband-modem-mbim.c:1581:35: error: unused variable ‘ctx’ [-Werror=unused-variable]
InitializationStartedContext *ctx;
^~~
cc1: all warnings being treated as errors
mm_plugin_supports_port_finish directly casts the value returned by
g_task_propagate_int to MMPluginSupportsResult enum value, which
implicitly assumes MM_PLUGIN_SUPPORTS_PORT_UNKNOWN equals to -1.
Instead of relying on such an implicit assumption, this patch modifies
the code to check if the GError argument to g_task_propagate_error is
populated instead.
When returning an enum value via g_task_return_int, some code assumes
the enum value is always non-negative and thus considers that a negative
value implies an error. This assumption could be invalidated if a
negative value is later added to the enum. To make it less error prone
to future changes, this patch modifies the code to check if the GError
argument to g_task_propagate_error is populated instead.