aboutsummaryrefslogtreecommitdiff
path: root/src/mm-iface-modem-firmware.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksandermj@chromium.org>2024-03-12 11:52:24 +0000
committerAleksander Morgado <aleksandermj@chromium.org>2024-03-12 11:54:53 +0000
commit818bcd40d7e76b623171fc525be2ab5776eadeca (patch)
treea5a7d507029ac0e7fd33ba5f7d94a778601357ad /src/mm-iface-modem-firmware.c
parentbd255849dcdbcaa3280033b0974a6a5e0473566e (diff)
iface-modem-firmware: fix assert if ports have been removed
The logic to build the generic device ids may run by the time we have already removed the ports in the modem. If so, just cleanly error out and avoid the assertion. 0x00007df14bb03a3f (libc.so.6 - pthread_kill.c: 44) __pthread_kill_implementation 0x00007df14bab8c6c (libc.so.6 - raise.c: 26) raise 0x00007df14baa4462 (libc.so.6 - abort.c: 79) abort 0x00007df14c2c8686 (libglib-2.0.so.0 - gtestutils.c: 3450) g_assertion_message 0x00007df14c2c86fa (libglib-2.0.so.0 - gtestutils.c: 3476) g_assertion_message_expr 0x000059ff23c90c90 (ModemManager - mm-iface-modem-firmware.c: 353) mm_iface_firmware_build_generic_device_ids 0x000059ff23ceef7d (ModemManager - mm-shared-fibocom.c: 495) fibocom_at_port_get_firmware_version_ready 0x00007df14c158e57 (libgio-2.0.so.0 - gtask.c: 1309) g_task_return_now 0x00007df14c158e8a (libgio-2.0.so.0 - gtask.c: 1323) complete_in_idle_cb 0x00007df14c2a47a4 (libglib-2.0.so.0 - gmain.c: 3460) g_main_dispatch 0x00007df14c2a47a4 (libglib-2.0.so.0 - gmain.c: 4200) g_main_context_dispatch 0x00007df14c2a4ac3 (libglib-2.0.so.0 - gmain.c: 4276) g_main_context_iterate 0x00007df14c2a4d41 (libglib-2.0.so.0 - gmain.c: 4479) g_main_loop_run 0x000059ff23c43741 (ModemManager - main.c: 221) main 0x00007df14baa46c5 (libc.so.6 - libc_start_call_main.h: 58) __libc_start_call_main 0x00007df14baa4781 (libc.so.6 - libc-start.c: 389) __libc_start_main_impl 0x000059ff23c430b0 (ModemManager + 0x000b00b0) _start 0x00007ffc53d5bd27
Diffstat (limited to 'src/mm-iface-modem-firmware.c')
-rw-r--r--src/mm-iface-modem-firmware.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mm-iface-modem-firmware.c b/src/mm-iface-modem-firmware.c
index 34df620a..413e33b7 100644
--- a/src/mm-iface-modem-firmware.c
+++ b/src/mm-iface-modem-firmware.c
@@ -350,7 +350,13 @@ mm_iface_firmware_build_generic_device_ids (MMIfaceModemFirmware *self,
#endif
if (!primary)
primary = MM_PORT (mm_base_modem_peek_port_primary (MM_BASE_MODEM (self)));
- g_assert (primary != NULL);
+
+ if (!primary) {
+ g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
+ "No valid primary port");
+ return NULL;
+ }
+
rid = mm_kernel_device_get_physdev_revision (mm_port_peek_kernel_device (primary));
subsystem = mm_kernel_device_get_physdev_subsystem (mm_port_peek_kernel_device (primary));