test: Refactor testNodeGetCPUMap

Drop locking of the driver since it is not accessed and simplify the
code flow.
This commit is contained in:
Peter Krempa 2015-06-22 16:10:49 +02:00
parent 3dd859c0c2
commit 774fd39984

View File

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