virStorageBackendLogicalParseVolExtents: Remove 'cleanup' and 'ret'

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>
This commit is contained in:
Peter Krempa 2021-08-04 12:21:22 +02:00
parent e03e54c9a2
commit 51733511d1

View 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;
}