summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2023-12-24 16:30:40 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2023-12-24 16:47:42 +0100
commit54cbad304cca7a588cc6d59d9e62fff757514ebb (patch)
tree24c1af58f54df6d2eebf169559328bf74ebd0c08 /src
parentMerge pull request #30620 from mrc0mmand/more-test-tweaks (diff)
downloadsystemd-54cbad304cca7a588cc6d59d9e62fff757514ebb.tar.xz
systemd-54cbad304cca7a588cc6d59d9e62fff757514ebb.zip
sd-device: shorten code a big
Suggested by coccinelle.
Diffstat (limited to '')
-rw-r--r--src/libsystemd/sd-device/device-enumerator.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/libsystemd/sd-device/device-enumerator.c b/src/libsystemd/sd-device/device-enumerator.c
index 15c5c42ade..11e418e247 100644
--- a/src/libsystemd/sd-device/device-enumerator.c
+++ b/src/libsystemd/sd-device/device-enumerator.c
@@ -662,10 +662,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;
}
}