From debdcbcc47177bfaf50306cbdc81d0689c2d866d Mon Sep 17 00:00:00 2001 From: illiliti Date: Sun, 5 Jul 2020 03:11:55 +0300 Subject: [PATCH] fix parent --- udev_device.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/udev_device.c b/udev_device.c index a2d1108..4a14b64 100644 --- a/udev_device.c +++ b/udev_device.c @@ -158,7 +158,9 @@ UDEV_EXPORT struct udev_device *udev_device_get_parent_with_subsystem_devtype(st return NULL; } - while ((parent = udev_device_get_parent(udev_device))) { + parent = udev_device_get_parent(udev_device); + + while (parent) { parent_subsystem = udev_device_get_subsystem(parent); parent_devtype = udev_device_get_devtype(parent); @@ -171,6 +173,8 @@ UDEV_EXPORT struct udev_device *udev_device_get_parent_with_subsystem_devtype(st return parent; } } + + parent = udev_device_get_parent(parent); } return NULL;