Signed-off-by: Daniel Henrique Barboza <danielhb413(a)gmail.com>
---
tests/qemumonitortestutils.c | 15 +++++----------
tests/testutilsqemu.c | 8 ++------
tests/virhostdevtest.c | 14 +++++---------
3 files changed, 12 insertions(+), 25 deletions(-)
diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c
index 617a2997d1..b29e5d8cd2 100644
--- a/tests/qemumonitortestutils.c
+++ b/tests/qemumonitortestutils.c
@@ -1078,15 +1078,13 @@ qemuMonitorCommonTestNew(virDomainXMLOptionPtr xmlopt,
if (virNetSocketListen(test->server, 1) < 0)
goto error;
- cleanup:
return test;
error:
VIR_FREE(path);
VIR_FREE(tmpdir_template);
qemuMonitorTestFree(test);
- test = NULL;
- goto cleanup;
+ return NULL;
}
@@ -1100,10 +1098,10 @@ qemuMonitorCommonTestInit(qemuMonitorTestPtr test)
return -1;
if (virNetSocketAccept(test->server, &test->client) < 0)
- goto error;
+ return -1;
if (!test->client)
- goto error;
+ return -1;
if (test->outgoingLength > 0)
events = VIR_EVENT_HANDLE_WRITABLE;
@@ -1113,7 +1111,7 @@ qemuMonitorCommonTestInit(qemuMonitorTestPtr test)
qemuMonitorTestIO,
test,
NULL) < 0)
- goto error;
+ return -1;
virMutexLock(&test->lock);
if (virThreadCreate(&test->thread,
@@ -1121,15 +1119,12 @@ qemuMonitorCommonTestInit(qemuMonitorTestPtr test)
qemuMonitorTestWorker,
test) < 0) {
virMutexUnlock(&test->lock);
- goto error;
+ return -1;
}
test->started = test->running = true;
virMutexUnlock(&test->lock);
return 0;
-
- error:
- return -1;
}
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index 8a4fdb1949..9db0cb44c6 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -449,10 +449,9 @@ testQemuCapsSetGIC(virQEMUCapsPtr qemuCaps,
{
virGICCapability *gicCapabilities = NULL;
size_t ngicCapabilities = 0;
- int ret = -1;
if (VIR_ALLOC_N(gicCapabilities, 2) < 0)
- goto out;
+ return -1;
# define IMPL_BOTH \
VIR_GIC_IMPLEMENTATION_KERNEL|VIR_GIC_IMPLEMENTATION_EMULATED
@@ -473,10 +472,7 @@ testQemuCapsSetGIC(virQEMUCapsPtr qemuCaps,
virQEMUCapsSetGICCapabilities(qemuCaps,
gicCapabilities, ngicCapabilities);
- ret = 0;
-
- out:
- return ret;
+ return 0;
}
#endif
diff --git a/tests/virhostdevtest.c b/tests/virhostdevtest.c
index b76b78eb56..b6260bd9c1 100644
--- a/tests/virhostdevtest.c
+++ b/tests/virhostdevtest.c
@@ -539,8 +539,6 @@ testVirHostdevOther(const void *opaque G_GNUC_UNUSED)
static int
testNVMeDiskRoundtrip(const void *opaque G_GNUC_UNUSED)
{
- int ret = -1;
-
/* Don't rely on a state that previous test cases might have
* left the manager in. Start with a clean slate. */
virHostdevReAttachPCIDevices(mgr, drv_name, dom_name,
@@ -552,7 +550,7 @@ testNVMeDiskRoundtrip(const void *opaque G_GNUC_UNUSED)
/* Firstly, attach all NVMe disks */
if (virHostdevPrepareNVMeDevices(mgr, drv_name, dom_name, disks, ndisks) < 0)
- goto cleanup;
+ return -1;
CHECK_NVME_LIST_COUNT(mgr->activeNVMeHostdevs, 3);
CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, 2);
@@ -560,7 +558,7 @@ testNVMeDiskRoundtrip(const void *opaque G_GNUC_UNUSED)
/* Now, try to detach the first one. */
if (virHostdevReAttachNVMeDevices(mgr, drv_name, dom_name, disks, 1) < 0)
- goto cleanup;
+ return -1;
CHECK_NVME_LIST_COUNT(mgr->activeNVMeHostdevs, 2);
CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, 2);
@@ -568,7 +566,7 @@ testNVMeDiskRoundtrip(const void *opaque G_GNUC_UNUSED)
/* And the last one */
if (virHostdevReAttachNVMeDevices(mgr, drv_name, dom_name, &disks[2], 1) < 0)
- goto cleanup;
+ return -1;
CHECK_NVME_LIST_COUNT(mgr->activeNVMeHostdevs, 1);
CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, 1);
@@ -576,15 +574,13 @@ testNVMeDiskRoundtrip(const void *opaque G_GNUC_UNUSED)
/* Finally, detach the middle one */
if (virHostdevReAttachNVMeDevices(mgr, drv_name, dom_name, &disks[1], 1) < 0)
- goto cleanup;
+ return -1;
CHECK_NVME_LIST_COUNT(mgr->activeNVMeHostdevs, 0);
CHECK_PCI_LIST_COUNT(mgr->activePCIHostdevs, 0);
CHECK_PCI_LIST_COUNT(mgr->inactivePCIHostdevs, 0);
- ret = 0;
- cleanup:
- return ret;
+ return 0;
}
--
2.24.1