1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-12 13:17:58 +03:00

virStorageFileGetMetadataRecurse: Remove 'cleanup' label

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>
This commit is contained in:
Peter Krempa 2020-02-17 13:04:26 +01:00
parent 01adad0932
commit a570dc6767

View File

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