]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
test: Refactor testNodeGetCPUMap
authorPeter Krempa <pkrempa@redhat.com>
Mon, 22 Jun 2015 14:10:49 +0000 (16:10 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 25 Jun 2015 13:09:11 +0000 (15:09 +0200)
Drop locking of the driver since it is not accessed and simplify the
code flow.

src/test/test_driver.c

index fcc31b05fff0d132b039737034245e0ad5dd6ab8..d38006f59c8147a6a108a7b16ab0fd0745b2e384 100644 (file)
@@ -5617,31 +5617,23 @@ static int testConnectListAllDomains(virConnectPtr conn,
 }
 
 static int
-testNodeGetCPUMap(virConnectPtr conn,
+testNodeGetCPUMap(virConnectPtr conn ATTRIBUTE_UNUSED,
                   unsigned char **cpumap,
                   unsigned int *online,
                   unsigned int flags)
 {
-    testDriverPtr privconn = conn->privateData;
-    int ret = -1;
-
     virCheckFlags(0, -1);
 
-    testDriverLock(privconn);
     if (cpumap) {
         if (VIR_ALLOC_N(*cpumap, 1) < 0)
-            goto cleanup;
+            return -1;
         *cpumap[0] = 0x15;
     }
 
     if (online)
         *online = 3;
 
-    ret = 8;
-
- cleanup:
-    testDriverUnlock(privconn);
-    return ret;
+    return  8;
 }
 
 static char *