From 54cbad304cca7a588cc6d59d9e62fff757514ebb Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Mon, 25 Dec 2023 00:30:40 +0900 Subject: [PATCH] sd-device: shorten code a big Suggested by coccinelle. --- src/libsystemd/sd-device/device-enumerator.c | 4 +--- 1 file changed, 1 insertion(+), 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; } }