]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tests: nodedev: remove unnecessary cleanup label
authorJonathon Jongsma <jjongsma@redhat.com>
Tue, 13 Apr 2021 20:29:15 +0000 (15:29 -0500)
committerJonathon Jongsma <jjongsma@redhat.com>
Mon, 19 Apr 2021 15:24:13 +0000 (10:24 -0500)
Now that the last cleanup task was removed in the previous commit, just
remove the label and return early on error rather than goto cleanup.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
tests/nodedevmdevctltest.c

index 65286761c1835f1c3fd907cfdb591cf3378a98d4..8ba1d2da702e22dfc0e02cef8232f06be366dd8e 100644 (file)
@@ -44,7 +44,6 @@ testMdevctlCmd(virMdevctlCommand cmd_type,
     g_autoptr(virNodeDeviceDef) def = NULL;
     g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
     const char *actualCmdline = NULL;
-    int ret = -1;
     g_autofree char *outbuf = NULL;
     g_autofree char *errbuf = NULL;
     g_autofree char *stdinbuf = NULL;
@@ -64,18 +63,18 @@ testMdevctlCmd(virMdevctlCommand cmd_type,
             break;
         case MDEVCTL_CMD_LAST:
         default:
-            goto cleanup;
+            return -1;
     }
 
     if (!(def = virNodeDeviceDefParseFile(mdevxml, create, VIRT_TYPE)))
-        goto cleanup;
+        return -1;
 
     /* this function will set a stdin buffer containing the json configuration
      * of the device. The json value is captured in the callback above */
     cmd = nodeDeviceGetMdevctlCommand(def, cmd_type, &outbuf, &errbuf);
 
     if (!cmd)
-        goto cleanup;
+        return -1;
 
     if (create)
         virCommandSetDryRun(dryRunToken, &buf, true, true,
@@ -84,21 +83,18 @@ testMdevctlCmd(virMdevctlCommand cmd_type,
         virCommandSetDryRun(dryRunToken, &buf, true, true, NULL, NULL);
 
     if (virCommandRun(cmd, NULL) < 0)
-        goto cleanup;
+        return -1;
 
     if (!(actualCmdline = virBufferCurrentContent(&buf)))
-        goto cleanup;
+        return -1;
 
     if (virTestCompareToFileFull(actualCmdline, cmdfile, false) < 0)
-        goto cleanup;
+        return -1;
 
     if (create && virTestCompareToFile(stdinbuf, jsonfile) < 0)
-        goto cleanup;
-
-    ret = 0;
+        return -1;
 
- cleanup:
-    return ret;
+    return 0;
 }