[PATCH 1/3] qemu: domain: Sanitize return value handling in disk presence checker

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



One of the functions is returning always 0 and the second one uses
unnecessary labels.
---
 src/qemu/qemu_domain.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index c21465d..fe64a55 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -3863,7 +3863,7 @@ qemuDomainSetFakeReboot(virQEMUDriverPtr driver,
     virObjectUnref(cfg);
 }

-static int
+static void
 qemuDomainCheckRemoveOptionalDisk(virQEMUDriverPtr driver,
                                   virDomainObjPtr vm,
                                   size_t diskIndex)
@@ -3895,8 +3895,6 @@ qemuDomainCheckRemoveOptionalDisk(virQEMUDriverPtr driver,
     }

     qemuDomainEventQueue(driver, event);
-
-    return 0;
 }

 static int
@@ -3916,15 +3914,15 @@ qemuDomainCheckDiskStartupPolicy(virQEMUDriverPtr driver,
             if (!cold_boot &&
                 device != VIR_DOMAIN_DISK_DEVICE_FLOPPY &&
                 device != VIR_DOMAIN_DISK_DEVICE_CDROM)
-                goto error;
+                return -1;
             break;

         case VIR_DOMAIN_STARTUP_POLICY_MANDATORY:
-            goto error;
+            return -1;

         case VIR_DOMAIN_STARTUP_POLICY_REQUISITE:
             if (cold_boot)
-                goto error;
+                return -1;
             break;

         case VIR_DOMAIN_STARTUP_POLICY_DEFAULT:
@@ -3933,13 +3931,9 @@ qemuDomainCheckDiskStartupPolicy(virQEMUDriverPtr driver,
             break;
     }

-    if (qemuDomainCheckRemoveOptionalDisk(driver, vm, diskIndex) < 0)
-        goto error;
+    qemuDomainCheckRemoveOptionalDisk(driver, vm, diskIndex);

     return 0;
-
- error:
-    return -1;
 }


-- 
2.8.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]