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

Peter Krempa posted 10 patches 6 years, 7 months ago
[libvirt] [PATCH 06/10] qemu: command: get rid of 'cleanup' in qemuBuildDiskSourceCommandLine
Posted by Peter Krempa 6 years, 7 months ago
Signed-off-by: Peter Krempa <pkrempa@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

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 06/10] qemu: command: get rid of 'cleanup' in qemuBuildDiskSourceCommandLine
Posted by Ján Tomko 6 years, 7 months ago
On Mon, Jun 24, 2019 at 05:38:51PM +0200, Peter Krempa wrote:
>Signed-off-by: Peter Krempa <pkrempa@redhat.com>
>---
> src/qemu/qemu_command.c | 22 ++++++++--------------
> 1 file changed, 8 insertions(+), 14 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

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