diff options
author | Aleksander Morgado <aleksandermj@chromium.org> | 2022-11-22 11:25:25 +0000 |
---|---|---|
committer | Aleksander Morgado <aleksandermj@chromium.org> | 2022-11-22 11:28:30 +0000 |
commit | f8e544483cc482d8c525cea9f7c52cfa764b657c (patch) | |
tree | d0e30997e749cd1655c3397520c5a50cc612da5f /src/mm-broadband-modem-qmi.c | |
parent | 65efdded070af57bac8171ed686706dbd447c9a4 (diff) |
broadband-modem-qmi: don't fail profile update indications setup if one client missing
Using mm_shared_qmi_ensure_client() ensures that the client must exist
or otherwise the operation would fail. Instead, try to peek the
clients independently with mm_shared_qmi_peek_client() and only fail
if both exist.
The state machine logic already treats the clients as optional.
Diffstat (limited to 'src/mm-broadband-modem-qmi.c')
-rw-r--r-- | src/mm-broadband-modem-qmi.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/mm-broadband-modem-qmi.c b/src/mm-broadband-modem-qmi.c index 82d8a3c8..98e53bba 100644 --- a/src/mm-broadband-modem-qmi.c +++ b/src/mm-broadband-modem-qmi.c @@ -6584,16 +6584,6 @@ common_enable_disable_unsolicited_events_3gpp_profile_manager (MMBroadbandModemQ QmiClient *client_pdc = NULL; QmiClient *client_wds = NULL; - if (!mm_shared_qmi_ensure_client (MM_SHARED_QMI (self), - QMI_SERVICE_PDC, &client_pdc, - callback, user_data)) - return; - - if (!mm_shared_qmi_ensure_client (MM_SHARED_QMI (self), - QMI_SERVICE_WDS, &client_wds, - callback, user_data)) - return; - task = g_task_new (self, NULL, callback, user_data); if (enable == self->priv->profile_manager_unsolicited_events_enabled) { @@ -6604,6 +6594,23 @@ common_enable_disable_unsolicited_events_3gpp_profile_manager (MMBroadbandModemQ return; } + client_pdc = mm_shared_qmi_peek_client (MM_SHARED_QMI (self), + QMI_SERVICE_PDC, + MM_PORT_QMI_FLAG_DEFAULT, + NULL); + client_wds = mm_shared_qmi_peek_client (MM_SHARED_QMI (self), + QMI_SERVICE_WDS, + MM_PORT_QMI_FLAG_DEFAULT, + NULL); + + /* Fail if none of the clients can be allocated */ + if (!client_pdc && !client_wds) { + g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_FAILED, + "No support for profile refresh events"); + g_object_unref (task); + return; + } + ctx = g_new0 (RegisterProfileRefreshContext, 1); ctx->step = REGISTER_PROFILE_REFRESH_STEP_FIRST; ctx->enable = enable; |