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(a)redhat.com>
---
src/storage/storage_backend_logical.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/src/storage/storage_backend_logical.c
b/src/storage/storage_backend_logical.c
index 90e7c9e41d..ed490b0201 100644
--- a/src/storage/storage_backend_logical.c
+++ b/src/storage/storage_backend_logical.c
@@ -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;
}
--
2.31.1