virHostCPUCountThreadSiblings: Refactor cleanup

Use automatic memory freeing for the temporary bitmap and remove the
pointless 'cleanup' section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2021-12-07 17:22:26 +01:00
parent 4aa3d8fffa
commit 19228b6016

View File

@ -271,17 +271,12 @@ virHostCPUGetSiblingsList(unsigned int cpu)
static unsigned long
virHostCPUCountThreadSiblings(unsigned int cpu)
{
virBitmap *siblings_map;
unsigned long ret = 0;
g_autoptr(virBitmap) siblings_map = NULL;
if (!(siblings_map = virHostCPUGetSiblingsList(cpu)))
goto cleanup;
return 0;
ret = virBitmapCountBits(siblings_map);
cleanup:
virBitmapFree(siblings_map);
return ret;
return virBitmapCountBits(siblings_map);
}
/* parses a node entry, returning number of processors in the node and