render / rpms / libvirt

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