aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2021-07-22 16:06:01 +0200
committerAleksander Morgado <aleksander@aleksander.es>2021-07-27 00:39:29 +0200
commitae09baf61b208bb155ace947b128abefb00b8e4d (patch)
treee0d63a1cd3af469a837110197903a4d0264eda1a /src
parent9be34affe25d317c4391be38d2a1887ac785d76a (diff)
port-qmi: cleanly close device if an open operation failed
ModemManager[703345]: <debug> [1626962477.971869] [modem0] couldn't open QMI port with data format update: Unexpected kernel data mode: cannot setup using CTL ModemManager[703345]: <debug> [1626962477.972197] [cdc-wdm0/qmi] Opening QMI device... ModemManager[703345]: <debug> [1626962477.972310] [cdc-wdm0/qmi] Checking if QMI device already opening... ModemManager[703345]: <warn> [1626962477.975182] [modem0] couldn't start initialization: QMI device open/close operation in progress
Diffstat (limited to 'src')
-rw-r--r--src/mm-port-qmi.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/mm-port-qmi.c b/src/mm-port-qmi.c
index ba81452d..9263ae86 100644
--- a/src/mm-port-qmi.c
+++ b/src/mm-port-qmi.c
@@ -2442,9 +2442,12 @@ port_open_step (GTask *task)
else if (ctx->kernel_data_modes & MM_PORT_QMI_KERNEL_DATA_MODE_802_3)
open_flags |= QMI_DEVICE_OPEN_FLAGS_NET_802_3;
else {
- g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
- "Unexpected kernel data mode: cannot setup using CTL");
- g_object_unref (task);
+ /* Set error and jump to last step, so that we cleanly close the device
+ * in case we need to reopen it right away */
+ ctx->error = g_error_new (MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
+ "Unexpected kernel data mode: cannot setup using CTL");
+ ctx->step = PORT_OPEN_STEP_LAST;
+ port_open_step (task);
return;
}