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