]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: use VIR_AUTOPTR virNodeSuspendSupportsTargetPMUtils
authorJán Tomko <jtomko@redhat.com>
Tue, 13 Aug 2019 15:16:26 +0000 (17:16 +0200)
committerJán Tomko <jtomko@redhat.com>
Wed, 14 Aug 2019 09:27:38 +0000 (11:27 +0200)
Get rid of the ret variable as well as the cleanup label.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
src/util/virnodesuspend.c

index 3fc5b93ac765e04ca73e10d63dc1ce38a468ba0a..392666da4584b08ed692021a42a7ac0ec801b715 100644 (file)
@@ -238,9 +238,8 @@ int virNodeSuspend(unsigned int target,
 static int
 virNodeSuspendSupportsTargetPMUtils(unsigned int target, bool *supported)
 {
-    virCommandPtr cmd;
+    VIR_AUTOPTR(virCommand) cmd = NULL;
     int status;
-    int ret = -1;
 
     *supported = false;
 
@@ -255,22 +254,19 @@ virNodeSuspendSupportsTargetPMUtils(unsigned int target, bool *supported)
         cmd = virCommandNewArgList("pm-is-supported", "--suspend-hybrid", NULL);
         break;
     default:
-        return ret;
+        return -1;
     }
 
     if (virCommandRun(cmd, &status) < 0)
-        goto cleanup;
+        return -1;
 
    /*
     * Check return code of command == 0 for success
     * (i.e., the PM capability is supported)
     */
     *supported = (status == 0);
-    ret = 0;
 
- cleanup:
-    virCommandFree(cmd);
-    return ret;
+    return 0;
 }
 #else /* ! WITH_PM_UTILS */
 static int