summaryrefslogtreecommitdiffstats
path: root/src/libsystemd/sd-device/device-enumerator.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/libsystemd/sd-device/device-enumerator.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/libsystemd/sd-device/device-enumerator.c b/src/libsystemd/sd-device/device-enumerator.c
index 15c5c42..71ab3d8 100644
--- a/src/libsystemd/sd-device/device-enumerator.c
+++ b/src/libsystemd/sd-device/device-enumerator.c
@@ -370,12 +370,8 @@ static int enumerator_sort_devices(sd_device_enumerator *enumerator) {
HASHMAP_FOREACH_KEY(device, syspath, enumerator->devices_by_syspath) {
_cleanup_free_ char *p = NULL;
- const char *subsys;
- if (sd_device_get_subsystem(device, &subsys) < 0)
- continue;
-
- if (!streq(subsys, *prioritized_subsystem))
+ if (!device_in_subsystem(device, *prioritized_subsystem))
continue;
devices[n++] = sd_device_ref(device);
@@ -662,10 +658,8 @@ static int enumerator_add_parent_devices(
continue;
r = device_enumerator_add_device(enumerator, device);
- if (r < 0)
+ if (r <= 0) /* r == 0 means the device already exists, then no need to go further up. */
return r;
- if (r == 0) /* Exists already? Then no need to go further up. */
- return 0;
}
}