render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
fbe740
From 0b9e19e4d91694f3f55318409b120d132d1db987 Mon Sep 17 00:00:00 2001
fbe740
Message-Id: <0b9e19e4d91694f3f55318409b120d132d1db987@dist-git>
fbe740
From: Peter Krempa <pkrempa@redhat.com>
fbe740
Date: Fri, 28 Feb 2020 10:24:34 +0100
fbe740
Subject: [PATCH] virStorageFileGetMetadataRecurse: Remove 'cleanup' label
fbe740
MIME-Version: 1.0
fbe740
Content-Type: text/plain; charset=UTF-8
fbe740
Content-Transfer-Encoding: 8bit
fbe740
fbe740
There's nothing to clean up. Make it obvious what is returned.
fbe740
fbe740
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
fbe740
Reviewed-by: Eric Blake <eblake@redhat.com>
fbe740
(cherry picked from commit a570dc67675618e3946bef7e49c685f56bb258e3)
fbe740
fbe740
https://bugzilla.redhat.com/show_bug.cgi?id=1798148
fbe740
Message-Id: <1aed0cf359219aa713ded5159d3f04b080e3042c.1582881363.git.pkrempa@redhat.com>
fbe740
Reviewed-by: Ján Tomko <jtomko@redhat.com>
fbe740
---
fbe740
 src/util/virstoragefile.c | 50 +++++++++++++++------------------------
fbe740
 1 file changed, 19 insertions(+), 31 deletions(-)
fbe740
fbe740
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
fbe740
index 7295cebd08..5a74034ec4 100644
fbe740
--- a/src/util/virstoragefile.c
fbe740
+++ b/src/util/virstoragefile.c
fbe740
@@ -5010,7 +5010,6 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
fbe740
                                  virHashTablePtr cycle,
fbe740
                                  unsigned int depth)
fbe740
 {
fbe740
-    int ret = -1;
fbe740
     size_t headerLen;
fbe740
     int backingFormat;
fbe740
     int rv;
fbe740
@@ -5030,19 +5029,16 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
fbe740
                                                    &buf, &headerLen, cycle) < 0)
fbe740
         return -1;
fbe740
 
fbe740
-    if (virStorageFileGetMetadataInternal(src, buf, headerLen,
fbe740
-                                          &backingFormat) < 0)
fbe740
-        goto cleanup;
fbe740
+    if (virStorageFileGetMetadataInternal(src, buf, headerLen, &backingFormat) < 0)
fbe740
+        return -1;
fbe740
 
fbe740
     if (src->backingStoreRaw) {
fbe740
         if ((rv = virStorageSourceNewFromBacking(src, &backingStore)) < 0)
fbe740
-            goto cleanup;
fbe740
+            return -1;
fbe740
 
fbe740
-        if (rv == 1) {
fbe740
-            /* the backing file would not be usable for VM usage */
fbe740
-            ret = 0;
fbe740
-            goto cleanup;
fbe740
-        }
fbe740
+        /* the backing file would not be usable for VM usage */
fbe740
+        if (rv == 1)
fbe740
+            return 0;
fbe740
 
fbe740
         backingStore->format = backingFormat;
fbe740
 
fbe740
@@ -5065,17 +5061,14 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
fbe740
         if (backingStore->format == VIR_STORAGE_FILE_AUTO_SAFE)
fbe740
             backingStore->format = VIR_STORAGE_FILE_AUTO;
fbe740
 
fbe740
-        if ((ret = virStorageFileGetMetadataRecurse(backingStore, parent,
fbe740
-                                                    uid, gid,
fbe740
-                                                    report_broken,
fbe740
-                                                    cycle, depth + 1)) < 0) {
fbe740
+        if (virStorageFileGetMetadataRecurse(backingStore, parent,
fbe740
+                                             uid, gid,
fbe740
+                                             report_broken,
fbe740
+                                             cycle, depth + 1) < 0) {
fbe740
             if (report_broken)
fbe740
-                goto cleanup;
fbe740
-
fbe740
-            /* if we fail somewhere midway, just accept and return a
fbe740
-             * broken chain */
fbe740
-            ret = 0;
fbe740
-            goto cleanup;
fbe740
+                return -1;
fbe740
+            else
fbe740
+                return 0;
fbe740
         }
fbe740
 
fbe740
         backingStore->id = depth;
fbe740
@@ -5083,7 +5076,7 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
fbe740
     } else {
fbe740
         /* add terminator */
fbe740
         if (!(src->backingStore = virStorageSourceNew()))
fbe740
-            goto cleanup;
fbe740
+            return -1;
fbe740
     }
fbe740
 
fbe740
     if (src->externalDataStoreRaw) {
fbe740
@@ -5091,21 +5084,16 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
fbe740
 
fbe740
         if ((rv = virStorageSourceNewFromExternalData(src,
fbe740
                                                       &externalDataStore)) < 0)
fbe740
-            goto cleanup;
fbe740
+            return -1;
fbe740
 
fbe740
-        if (rv == 1) {
fbe740
-            /* the file would not be usable for VM usage */
fbe740
-            ret = 0;
fbe740
-            goto cleanup;
fbe740
-        }
fbe740
+        /* the file would not be usable for VM usage */
fbe740
+        if (rv == 1)
fbe740
+            return 0;
fbe740
 
fbe740
         src->externalDataStore = g_steal_pointer(&externalDataStore);
fbe740
     }
fbe740
 
fbe740
-    ret = 0;
fbe740
-
fbe740
- cleanup:
fbe740
-    return ret;
fbe740
+    return 0;
fbe740
 }
fbe740
 
fbe740
 
fbe740
-- 
fbe740
2.25.1
fbe740