Blob Blame History Raw
From 0b9e19e4d91694f3f55318409b120d132d1db987 Mon Sep 17 00:00:00 2001
Message-Id: <0b9e19e4d91694f3f55318409b120d132d1db987@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Fri, 28 Feb 2020 10:24:34 +0100
Subject: [PATCH] virStorageFileGetMetadataRecurse: Remove 'cleanup' label
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

There's nothing to clean up. Make it obvious what is returned.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
(cherry picked from commit a570dc67675618e3946bef7e49c685f56bb258e3)

https://bugzilla.redhat.com/show_bug.cgi?id=1798148
Message-Id: <1aed0cf359219aa713ded5159d3f04b080e3042c.1582881363.git.pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
 src/util/virstoragefile.c | 50 +++++++++++++++------------------------
 1 file changed, 19 insertions(+), 31 deletions(-)

diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 7295cebd08..5a74034ec4 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -5010,7 +5010,6 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
                                  virHashTablePtr cycle,
                                  unsigned int depth)
 {
-    int ret = -1;
     size_t headerLen;
     int backingFormat;
     int rv;
@@ -5030,19 +5029,16 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
                                                    &buf, &headerLen, cycle) < 0)
         return -1;
 
-    if (virStorageFileGetMetadataInternal(src, buf, headerLen,
-                                          &backingFormat) < 0)
-        goto cleanup;
+    if (virStorageFileGetMetadataInternal(src, buf, headerLen, &backingFormat) < 0)
+        return -1;
 
     if (src->backingStoreRaw) {
         if ((rv = virStorageSourceNewFromBacking(src, &backingStore)) < 0)
-            goto cleanup;
+            return -1;
 
-        if (rv == 1) {
-            /* the backing file would not be usable for VM usage */
-            ret = 0;
-            goto cleanup;
-        }
+        /* the backing file would not be usable for VM usage */
+        if (rv == 1)
+            return 0;
 
         backingStore->format = backingFormat;
 
@@ -5065,17 +5061,14 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
         if (backingStore->format == VIR_STORAGE_FILE_AUTO_SAFE)
             backingStore->format = VIR_STORAGE_FILE_AUTO;
 
-        if ((ret = virStorageFileGetMetadataRecurse(backingStore, parent,
-                                                    uid, gid,
-                                                    report_broken,
-                                                    cycle, depth + 1)) < 0) {
+        if (virStorageFileGetMetadataRecurse(backingStore, parent,
+                                             uid, gid,
+                                             report_broken,
+                                             cycle, depth + 1) < 0) {
             if (report_broken)
-                goto cleanup;
-
-            /* if we fail somewhere midway, just accept and return a
-             * broken chain */
-            ret = 0;
-            goto cleanup;
+                return -1;
+            else
+                return 0;
         }
 
         backingStore->id = depth;
@@ -5083,7 +5076,7 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
     } else {
         /* add terminator */
         if (!(src->backingStore = virStorageSourceNew()))
-            goto cleanup;
+            return -1;
     }
 
     if (src->externalDataStoreRaw) {
@@ -5091,21 +5084,16 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
 
         if ((rv = virStorageSourceNewFromExternalData(src,
                                                       &externalDataStore)) < 0)
-            goto cleanup;
+            return -1;
 
-        if (rv == 1) {
-            /* the file would not be usable for VM usage */
-            ret = 0;
-            goto cleanup;
-        }
+        /* the file would not be usable for VM usage */
+        if (rv == 1)
+            return 0;
 
         src->externalDataStore = g_steal_pointer(&externalDataStore);
     }
 
-    ret = 0;
-
- cleanup:
-    return ret;
+    return 0;
 }
 
 
-- 
2.25.1