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.
This commit is contained in:
Aleksander Morgado
2022-11-22 11:25:25 +00:00
parent 65efdded07
commit f8e544483c

View File

@@ -6584,16 +6584,6 @@ common_enable_disable_unsolicited_events_3gpp_profile_manager (MMBroadbandModemQ
QmiClient *client_pdc = NULL; QmiClient *client_pdc = NULL;
QmiClient *client_wds = 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); task = g_task_new (self, NULL, callback, user_data);
if (enable == self->priv->profile_manager_unsolicited_events_enabled) { if (enable == self->priv->profile_manager_unsolicited_events_enabled) {
@@ -6604,6 +6594,23 @@ common_enable_disable_unsolicited_events_3gpp_profile_manager (MMBroadbandModemQ
return; 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 = g_new0 (RegisterProfileRefreshContext, 1);
ctx->step = REGISTER_PROFILE_REFRESH_STEP_FIRST; ctx->step = REGISTER_PROFILE_REFRESH_STEP_FIRST;
ctx->enable = enable; ctx->enable = enable;