Since the merge of udev.c into udevng.c all cleanup function must handle
both usb devices and serial devices. Add this distinction to
check_remove(), so that is doesn't try to iterate the .serial member as
if it were a .devices list.
---
 plugins/udevng.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/plugins/udevng.c b/plugins/udevng.c
index 4b565070..71a70f0b 100644
--- a/plugins/udevng.c
+++ b/plugins/udevng.c
@@ -1380,11 +1380,19 @@ static gboolean check_remove(gpointer key, gpointer 
value, gpointer user_data)
        const char *devpath = user_data;
        GSList *list;
 
-       for (list = modem->devices; list; list = list->next) {
-               struct device_info *info = list->data;
+       switch (modem->type) {
+       case MODEM_TYPE_USB:
+               for (list = modem->devices; list; list = list->next) {
+                       struct device_info *info = list->data;
 
-               if (g_strcmp0(info->devpath, devpath) == 0)
+                       if (g_strcmp0(info->devpath, devpath) == 0)
+                               return TRUE;
+               }
+               break;
+       case MODEM_TYPE_SERIAL:
+               if (g_strcmp0(modem->serial->devpath, devpath) == 0)
                        return TRUE;
+               break;
        }
 
        return FALSE;
-- 
2.18.0

_______________________________________________
ofono mailing list
[email protected]
https://lists.ofono.org/mailman/listinfo/ofono

Reply via email to