[PATCH 13/36] virHostCPUCountThreadSiblings: Refactor cleanup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/util/virhostcpu.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c
index 67b6910626..ad75eb5843 100644
--- a/src/util/virhostcpu.c
+++ b/src/util/virhostcpu.c
@@ -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
-- 
2.31.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux