]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virHostCPUCountThreadSiblings: Refactor cleanup
authorPeter Krempa <pkrempa@redhat.com>
Tue, 7 Dec 2021 16:22:26 +0000 (17:22 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 10 Dec 2021 15:36:24 +0000 (16:36 +0100)
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>
src/util/virhostcpu.c

index 67b6910626a34db8fedf5c244d569084e921fcb5..ad75eb5843627c8742dc337f228fa3b01159e237 100644 (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;
-
-    ret = virBitmapCountBits(siblings_map);
+        return 0;
 
- cleanup:
-    virBitmapFree(siblings_map);
-    return ret;
+    return virBitmapCountBits(siblings_map);
 }
 
 /* parses a node entry, returning number of processors in the node and