]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virStorageBackendLogicalParseVolExtents: Remove 'cleanup' and 'ret'
authorPeter Krempa <pkrempa@redhat.com>
Wed, 4 Aug 2021 10:21:22 +0000 (12:21 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 6 Aug 2021 06:53:26 +0000 (08:53 +0200)
The function was inconsistently using 'return -1' and 'goto cleanup;'
unify it by removing the cleanup label and 'ret' variable.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/storage/storage_backend_logical.c

index 90e7c9e41da7f9c0bbb7b369b3007936fc6338dd..ed490b0201ddba9b9451c5a89bb3e2d6333c5969 100644 (file)
@@ -122,7 +122,6 @@ virStorageBackendLogicalParseVolExtents(virStorageVolDef *vol,
     g_autoptr(GError) err = NULL;
     g_autoptr(GMatchInfo) info = NULL;
     int nextents;
-    int ret = -1;
     const char *regex_unit = "(\\S+)\\((\\S+)\\)";
     size_t i;
     unsigned long long offset;
@@ -144,20 +143,20 @@ virStorageBackendLogicalParseVolExtents(virStorageVolDef *vol,
         if (virStrToLong_i(groups[5], NULL, 10, &nextents) < 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("malformed volume extent stripes value"));
-            goto cleanup;
+            return -1;
         }
     }
 
     if (virStrToLong_ull(groups[6], NULL, 10, &length) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        "%s", _("malformed volume extent length value"));
-        goto cleanup;
+        return -1;
     }
 
     if (virStrToLong_ull(groups[7], NULL, 10, &size) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        "%s", _("malformed volume extent size value"));
-        goto cleanup;
+        return -1;
     }
 
     /* Allocate space for 'nextents' regex_unit strings plus a comma for each */
@@ -179,7 +178,7 @@ virStorageBackendLogicalParseVolExtents(virStorageVolDef *vol,
     if (!g_regex_match(re, groups[3], 0, &info)) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("malformed volume extent devices value"));
-        goto cleanup;
+        return -1;
     }
 
     /* Each extent has a "path:offset" pair, and match #0
@@ -197,7 +196,7 @@ virStorageBackendLogicalParseVolExtents(virStorageVolDef *vol,
         if (virStrToLong_ull(offset_str, NULL, 10, &offset) < 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("malformed volume extent offset value"));
-            goto cleanup;
+            return -1;
         }
 
         extent.path = g_match_info_fetch(info, j);
@@ -207,10 +206,7 @@ virStorageBackendLogicalParseVolExtents(virStorageVolDef *vol,
         VIR_APPEND_ELEMENT(vol->source.extents, vol->source.nextent, extent);
     }
 
-    ret = 0;
-
- cleanup:
-    return ret;
+    return 0;
 }