diff options
-rw-r--r-- | plugins/huawei/mm-broadband-modem-huawei.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/plugins/huawei/mm-broadband-modem-huawei.c b/plugins/huawei/mm-broadband-modem-huawei.c index d3f11b55..3d743675 100644 --- a/plugins/huawei/mm-broadband-modem-huawei.c +++ b/plugins/huawei/mm-broadband-modem-huawei.c @@ -2197,6 +2197,7 @@ peek_port_at_for_data (MMBroadbandModemHuawei *self, { GList *cdc_wdm_at_ports, *l; const gchar *net_port_parent_path; + MMPortSerialAt *found = NULL; g_warn_if_fail (mm_port_get_subsys (port) == MM_PORT_SUBSYS_NET); net_port_parent_path = mm_kernel_device_get_parent_sysfs_path (mm_port_peek_kernel_device (port)); @@ -2210,16 +2211,17 @@ peek_port_at_for_data (MMBroadbandModemHuawei *self, MM_PORT_SUBSYS_USB, MM_PORT_TYPE_AT, NULL); - for (l = cdc_wdm_at_ports; l; l = g_list_next (l)) { + for (l = cdc_wdm_at_ports; l && !found; l = g_list_next (l)) { const gchar *wdm_port_parent_path; g_assert (MM_IS_PORT_SERIAL_AT (l->data)); wdm_port_parent_path = mm_kernel_device_get_parent_sysfs_path (mm_port_peek_kernel_device (MM_PORT (l->data))); if (wdm_port_parent_path && g_str_equal (wdm_port_parent_path, net_port_parent_path)) - return MM_PORT_SERIAL_AT (l->data); + found = MM_PORT_SERIAL_AT (l->data); } - return NULL; + g_list_free_full (cdc_wdm_at_ports, g_object_unref); + return found; } |