[libvirt] [PATCH 06/10] qemu: command: get rid of 'cleanup' in qemuBuildDiskSourceCommandLine

Peter Krempa pkrempa at redhat.com
Mon Jun 24 15:38:51 UTC 2019


Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_command.c | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 1ae8a00352..7a7497686a 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2563,43 +2563,37 @@ qemuBuildDiskSourceCommandLine(virCommandPtr cmd,
     VIR_AUTOPTR(virJSONValue) copyOnReadProps = NULL;
     VIR_AUTOFREE(char *) copyOnReadPropsStr = NULL;
     size_t i;
-    int ret = -1;

     if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) {
-        if (virStorageSourceIsEmpty(disk->src)) {
-            ret = 0;
-            goto cleanup;
-        }
+        if (virStorageSourceIsEmpty(disk->src))
+            return 0;

         if (!(data = qemuBuildStorageSourceChainAttachPrepareBlockdev(disk->src,
                                                                       qemuCaps)))
-            goto cleanup;
+            return -1;

         if (disk->copy_on_read == VIR_TRISTATE_SWITCH_ON &&
             !(copyOnReadProps = qemuBlockStorageGetCopyOnReadProps(disk)))
-            goto cleanup;
+            return -1;
     } else {
         if (!(data = qemuBuildStorageSourceChainAttachPrepareDrive(disk, qemuCaps)))
-            goto cleanup;
+            return -1;
     }

     for (i = data->nsrcdata; i > 0; i--) {
         if (qemuBuildBlockStorageSourceAttachDataCommandline(cmd,
                                                              data->srcdata[i - 1]) < 0)
-            goto cleanup;
+            return -1;
     }

     if (copyOnReadProps) {
         if (!(copyOnReadPropsStr = virJSONValueToString(copyOnReadProps, false)))
-            goto cleanup;
+            return -1;

         virCommandAddArgList(cmd, "-blockdev", copyOnReadPropsStr, NULL);
     }

-    ret = 0;
-
- cleanup:
-    return ret;
+    return 0;
 }


-- 
2.21.0




More information about the libvir-list mailing list