[PATCH v2 2/2] qemu_process: remove unused cleanup labels

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

 



Signed-off-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx>
---
 src/qemu/qemu_hotplug.c | 50 +++++++++++++++++------------------------
 1 file changed, 21 insertions(+), 29 deletions(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 39b6cade58..8a46df9946 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1546,13 +1546,13 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver,
     unsigned int flags = 0;
 
     if (VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs + 1) < 0)
-        goto cleanup;
+        return -1;
 
     if (!cfg->relaxedACS)
         flags |= VIR_HOSTDEV_STRICT_ACS_CHECK;
     if (qemuHostdevPreparePCIDevices(driver, vm->def->name, vm->def->uuid,
                                      &hostdev, 1, priv->qemuCaps, flags) < 0)
-        goto cleanup;
+        return -1;
 
     /* this could have been changed by qemuHostdevPreparePCIDevices */
     backend = hostdev->source.subsys.u.pci.backend;
@@ -1656,7 +1656,6 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver,
 
     qemuHostdevReAttachPCIDevices(driver, vm->def->name, &hostdev, 1);
 
- cleanup:
     return -1;
 }
 
@@ -3299,23 +3298,19 @@ qemuDomainAttachLease(virQEMUDriverPtr driver,
                       virDomainObjPtr vm,
                       virDomainLeaseDefPtr lease)
 {
-    int ret = -1;
     g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
 
     if (virDomainLeaseInsertPreAlloc(vm->def) < 0)
-        goto cleanup;
+        return -1;
 
     if (virDomainLockLeaseAttach(driver->lockManager, cfg->uri,
                                  vm, lease) < 0) {
         virDomainLeaseInsertPreAlloced(vm->def, NULL);
-        goto cleanup;
+        return -1;
     }
 
     virDomainLeaseInsertPreAlloced(vm->def, lease);
-    ret = 0;
-
- cleanup:
-    return ret;
+    return 0;
 }
 
 
@@ -3330,7 +3325,7 @@ qemuDomainChangeNetBridge(virDomainObjPtr vm,
 
     if (!oldbridge || !newbridge) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Missing bridge name"));
-        goto cleanup;
+        return ret;
     }
 
     VIR_DEBUG("Change bridge for interface %s: %s -> %s",
@@ -3339,7 +3334,7 @@ qemuDomainChangeNetBridge(virDomainObjPtr vm,
     if (virNetDevExists(newbridge) != 1) {
         virReportError(VIR_ERR_OPERATION_FAILED,
                        _("bridge %s doesn't exist"), newbridge);
-        goto cleanup;
+        return ret;
     }
 
     ret = virNetDevBridgeRemovePort(oldbridge, olddev->ifname);
@@ -3363,12 +3358,10 @@ qemuDomainChangeNetBridge(virDomainObjPtr vm,
                            _("unable to recover former state by adding port "
                              "to bridge %s"), oldbridge);
         }
-        goto cleanup;
+        return ret;
     }
     /* caller will replace entire olddev with newdev in domain nets list */
-    ret = 0;
- cleanup:
-    return ret;
+    return 0;
 }
 
 static int
@@ -4019,14 +4012,14 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
         virReportError(VIR_ERR_DEVICE_MISSING,
                        _("cannot find existing graphics device to modify of "
                          "type '%s'"), type);
-        goto cleanup;
+        return ret;
     }
 
     if (dev->nListens != olddev->nListens) {
         virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
                        _("cannot change the number of listen addresses "
                          "on '%s' graphics"), type);
-        goto cleanup;
+        return ret;
     }
 
     for (i = 0; i < dev->nListens; i++) {
@@ -4037,7 +4030,7 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
             virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
                            _("cannot change the type of listen address "
                              "on '%s' graphics"), type);
-            goto cleanup;
+            return ret;
         }
 
         switch (newlisten->type) {
@@ -4046,7 +4039,7 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
                 virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
                                _("cannot change listen address setting "
                                  "on '%s' graphics"), type);
-                goto cleanup;
+                return ret;
             }
 
             break;
@@ -4056,7 +4049,7 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
                 virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
                                _("cannot change listen address setting "
                                  "on '%s' graphics"), type);
-                goto cleanup;
+                return ret;
             }
 
             break;
@@ -4066,7 +4059,7 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
                 virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
                                _("cannot change listen socket setting "
                                  "on '%s' graphics"), type);
-                goto cleanup;
+                return ret;
             }
             break;
 
@@ -4084,12 +4077,12 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
              (olddev->data.vnc.port != dev->data.vnc.port))) {
             virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                            _("cannot change port settings on vnc graphics"));
-            goto cleanup;
+            return ret;
         }
         if (STRNEQ_NULLABLE(olddev->data.vnc.keymap, dev->data.vnc.keymap)) {
             virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                            _("cannot change keymap setting on vnc graphics"));
-            goto cleanup;
+            return ret;
         }
 
         /* If a password lifetime was, or is set, or action if connected has
@@ -4108,7 +4101,7 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
                                                     cfg->vncPassword,
                                                     QEMU_ASYNC_JOB_NONE);
             if (ret < 0)
-                goto cleanup;
+                return ret;
 
             /* Steal the new dev's  char * reference */
             VIR_FREE(olddev->data.vnc.auth.passwd);
@@ -4130,13 +4123,13 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
              (olddev->data.spice.tlsPort != dev->data.spice.tlsPort))) {
             virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                            _("cannot change port settings on spice graphics"));
-            goto cleanup;
+            return ret;
         }
         if (STRNEQ_NULLABLE(olddev->data.spice.keymap,
                             dev->data.spice.keymap)) {
             virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                             _("cannot change keymap setting on spice graphics"));
-            goto cleanup;
+            return ret;
         }
 
         /* We must reset the password if it has changed but also if:
@@ -4160,7 +4153,7 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
                                                     QEMU_ASYNC_JOB_NONE);
 
             if (ret < 0)
-                goto cleanup;
+                return ret;
 
             /* Steal the new dev's char * reference */
             VIR_FREE(olddev->data.spice.auth.passwd);
@@ -4188,7 +4181,6 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
         break;
     }
 
- cleanup:
     return ret;
 }
 
-- 
2.21.0

--
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]

  Powered by Linux