]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
gpt-auto-generator: do not assign '*ret' on error
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 1 Sep 2018 14:07:18 +0000 (23:07 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 23 Sep 2018 08:18:50 +0000 (17:18 +0900)
src/gpt-auto-generator/gpt-auto-generator.c

index a088df811fd49dda7362165a2eca6199cf196f67..6b752214265107b21e6566e154378d6dc9f3c547 100644 (file)
@@ -462,34 +462,34 @@ static int open_parent(dev_t devnum, int *ret) {
                 r = sd_device_get_syspath(d, &name);
                 if (r < 0) {
                         log_debug_errno(r, "Device %u:%u does not have a name, ignoring: %m", major(devnum), minor(devnum));
-                        goto not_found;
+                        return 0;
                 }
         }
 
         r = sd_device_get_parent(d, &parent);
         if (r < 0) {
                 log_debug_errno(r, "%s: not a partitioned device, ignoring: %m", name);
-                goto not_found;
+                return 0;
         }
 
         /* Does it have a devtype? */
         r = sd_device_get_devtype(parent, &devtype);
         if (r < 0) {
                 log_debug_errno(r, "%s: parent doesn't have a device type, ignoring: %m", name);
-                goto not_found;
+                return 0;
         }
 
         /* Is this a disk or a partition? We only care for disks... */
         if (!streq(devtype, "disk")) {
                 log_debug("%s: parent isn't a raw disk, ignoring.", name);
-                goto not_found;
+                return 0;
         }
 
         /* Does it have a device node? */
         r = sd_device_get_devname(parent, &node);
         if (r < 0) {
                 log_debug_errno(r, "%s: parent device does not have device node, ignoring: %m", name);
-                goto not_found;
+                return 0;
         }
 
         log_debug("%s: root device %s.", name, node);
@@ -497,7 +497,7 @@ static int open_parent(dev_t devnum, int *ret) {
         r = sd_device_get_devnum(parent, &pn);
         if (r < 0) {
                 log_debug_errno(r, "%s: parent device is not a proper block device, ignoring: %m", name);
-                goto not_found;
+                return 0;
         }
 
         fd = open(node, O_RDONLY|O_CLOEXEC|O_NOCTTY);
@@ -506,14 +506,9 @@ static int open_parent(dev_t devnum, int *ret) {
 
         *ret = fd;
         return 1;
-
-not_found:
-        *ret = -1;
-        return 0;
 }
 
 static int enumerate_partitions(dev_t devnum) {
-
         _cleanup_close_ int fd = -1;
         _cleanup_(dissected_image_unrefp) DissectedImage *m = NULL;
         int r, k;