[libvirt PATCH 5/5] tests: virnetdev*: remove unnecessary labels

Ján Tomko jtomko at redhat.com
Fri Aug 20 13:15:32 UTC 2021


Signed-off-by: Ján Tomko <jtomko at redhat.com>
---
 tests/virnetdevbandwidthtest.c   |  9 +++------
 tests/virnetdevopenvswitchtest.c | 18 ++++++------------
 2 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/tests/virnetdevbandwidthtest.c b/tests/virnetdevbandwidthtest.c
index a17737ec40..eb4f47dfce 100644
--- a/tests/virnetdevbandwidthtest.c
+++ b/tests/virnetdevbandwidthtest.c
@@ -63,7 +63,6 @@ testVirNetDevBandwidthParse(virNetDevBandwidth **var,
 static int
 testVirNetDevBandwidthSet(const void *data)
 {
-    int ret = -1;
     const struct testSetStruct *info = data;
     const char *iface = info->iface;
     g_autoptr(virNetDevBandwidth) band = NULL;
@@ -80,7 +79,7 @@ testVirNetDevBandwidthSet(const void *data)
     virCommandSetDryRun(dryRunToken, &buf, false, false, NULL, NULL);
 
     if (virNetDevBandwidthSet(iface, band, info->hierarchical_class, true) < 0)
-        goto cleanup;
+        return -1;
 
     if (!(actual_cmd = virBufferContentAndReset(&buf))) {
         /* This is interesting, no command has been executed.
@@ -91,12 +90,10 @@ testVirNetDevBandwidthSet(const void *data)
         virTestDifference(stderr,
                           NULLSTR(info->exp_cmd),
                           NULLSTR(actual_cmd));
-        goto cleanup;
+        return -1;
     }
 
-    ret = 0;
- cleanup:
-    return ret;
+    return 0;
 }
 
 static int
diff --git a/tests/virnetdevopenvswitchtest.c b/tests/virnetdevopenvswitchtest.c
index 1026c890cd..2a20ba82d0 100644
--- a/tests/virnetdevopenvswitchtest.c
+++ b/tests/virnetdevopenvswitchtest.c
@@ -152,7 +152,6 @@ testNameEscape(const void *opaque)
 static int
 testVirNetDevOpenvswitchInterfaceSetQos(const void *data)
 {
-    int ret = -1;
     const struct testSetQosStruct *info = data;
     const char *iface = info->iface;
     g_autoptr(virNetDevBandwidth) band = NULL;
@@ -169,7 +168,7 @@ testVirNetDevOpenvswitchInterfaceSetQos(const void *data)
     virCommandSetDryRun(dryRunToken, &buf, false, false, NULL, NULL);
 
     if (virNetDevOpenvswitchInterfaceSetQos(iface, band, vm_id, true) < 0)
-        goto cleanup;
+        return -1;
 
     if (!(actual_cmd = virBufferContentAndReset(&buf))) {
         /* This is interesting, no command has been executed.
@@ -180,19 +179,16 @@ testVirNetDevOpenvswitchInterfaceSetQos(const void *data)
         virTestDifference(stderr,
                           NULLSTR(info->exp_cmd),
                           NULLSTR(actual_cmd));
-        goto cleanup;
+        return -1;
     }
 
-    ret = 0;
-    cleanup:
-    return ret;
+    return 0;
 }
 
 
 static int
 testVirNetDevOpenvswitchInterfaceClearQos(const void *data)
 {
-    int ret = -1;
     const struct testClearQosStruct *info = data;
     g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
     g_autofree char *actual_cmd = NULL;
@@ -203,7 +199,7 @@ testVirNetDevOpenvswitchInterfaceClearQos(const void *data)
     virCommandSetDryRun(dryRunToken, &buf, false, false, NULL, NULL);
 
     if (virNetDevOpenvswitchInterfaceClearQos(iface, vmid) < 0)
-        goto cleanup;
+        return -1;
 
     if (!(actual_cmd = virBufferContentAndReset(&buf))) {
         /* This is interesting, no command has been executed.
@@ -214,12 +210,10 @@ testVirNetDevOpenvswitchInterfaceClearQos(const void *data)
         virTestDifference(stderr,
                           NULLSTR(info->exp_cmd),
                           NULLSTR(actual_cmd));
-        goto cleanup;
+        return -1;
     }
 
-    ret = 0;
-    cleanup:
-    return ret;
+    return 0;
 }
 
 static int
-- 
2.31.1




More information about the libvir-list mailing list