]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
testQemuMonitorJSONqemuMonitorJSONGetBlockInfo: Remove superfluous `goto`s
authorTim Wiederhake <twiederh@redhat.com>
Mon, 5 Jul 2021 14:35:09 +0000 (16:35 +0200)
committerTim Wiederhake <twiederh@redhat.com>
Wed, 14 Jul 2021 13:37:07 +0000 (15:37 +0200)
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
tests/qemumonitorjsontest.c

index e4a907e5b63bcddb66c41d5f0e422ecff6f83617..7fd58dc2d1303ee8c6875febda087995d9e96e15 100644 (file)
@@ -1460,7 +1460,6 @@ testQemuMonitorJSONqemuMonitorJSONGetBlockInfo(const void *opaque)
 {
     const testGenericData *data = opaque;
     virDomainXMLOption *xmlopt = data->xmlopt;
-    int ret = -1;
     g_autoptr(GHashTable) blockDevices = NULL;
     g_autoptr(GHashTable) expectedBlockDevices = NULL;
     struct qemuDomainDiskInfo *info;
@@ -1471,14 +1470,14 @@ testQemuMonitorJSONqemuMonitorJSONGetBlockInfo(const void *opaque)
 
     if (!(blockDevices = virHashNew(g_free)) ||
         !(expectedBlockDevices = virHashNew(g_free)))
-        goto cleanup;
+        return -1;
 
     info = g_new0(struct qemuDomainDiskInfo, 1);
 
     if (virHashAddEntry(expectedBlockDevices, "virtio-disk0", info) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        "Unable to create expectedBlockDevices hash table");
-        goto cleanup;
+        return -1;
     }
 
     info = g_new0(struct qemuDomainDiskInfo, 1);
@@ -1486,7 +1485,7 @@ testQemuMonitorJSONqemuMonitorJSONGetBlockInfo(const void *opaque)
     if (virHashAddEntry(expectedBlockDevices, "virtio-disk1", info) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        "Unable to create expectedBlockDevices hash table");
-        goto cleanup;
+        return -1;
     }
 
     info = g_new0(struct qemuDomainDiskInfo, 1);
@@ -1497,7 +1496,7 @@ testQemuMonitorJSONqemuMonitorJSONGetBlockInfo(const void *opaque)
     if (virHashAddEntry(expectedBlockDevices, "ide0-1-0", info) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        "Unable to create expectedBlockDevices hash table");
-        goto cleanup;
+        return -1;
     }
 
     info = g_new0(struct qemuDomainDiskInfo, 1);
@@ -1509,24 +1508,22 @@ testQemuMonitorJSONqemuMonitorJSONGetBlockInfo(const void *opaque)
     if (virHashAddEntry(expectedBlockDevices, "ide0-1-1", info) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        "Unable to create expectedBlockDevices hash table");
-        goto cleanup;
+        return -1;
     }
 
     if (qemuMonitorTestAddItem(test, "query-block", queryBlockReply) < 0)
-        goto cleanup;
+        return -1;
 
     if (qemuMonitorJSONGetBlockInfo(qemuMonitorTestGetMonitor(test), blockDevices) < 0)
-        goto cleanup;
+        return -1;
 
     if (!virHashEqual(blockDevices, expectedBlockDevices, testHashEqualQemuDomainDiskInfo)) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        "Hashtable is different to the expected one");
-        goto cleanup;
+        return -1;
     }
 
-    ret = 0;
- cleanup:
-    return ret;
+    return 0;
 }
 
 static int