]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-device: shorten code a big
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 24 Dec 2023 15:30:40 +0000 (00:30 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 24 Dec 2023 15:47:42 +0000 (00:47 +0900)
Suggested by coccinelle.

src/libsystemd/sd-device/device-enumerator.c

index 15c5c42ade757f634bcf10cd6b1527c70e17c689..11e418e247bfce17257147d9141eba26d742ab8b 100644 (file)
@@ -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;
         }
 }