mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
util: use VIR_AUTOPTR virNodeSuspendSupportsTargetPMUtils
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>
This commit is contained in:
parent
4514abbd41
commit
7f5b43b09e
@ -238,9 +238,8 @@ int virNodeSuspend(unsigned int target,
|
|||||||
static int
|
static int
|
||||||
virNodeSuspendSupportsTargetPMUtils(unsigned int target, bool *supported)
|
virNodeSuspendSupportsTargetPMUtils(unsigned int target, bool *supported)
|
||||||
{
|
{
|
||||||
virCommandPtr cmd;
|
VIR_AUTOPTR(virCommand) cmd = NULL;
|
||||||
int status;
|
int status;
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
*supported = false;
|
*supported = false;
|
||||||
|
|
||||||
@ -255,22 +254,19 @@ virNodeSuspendSupportsTargetPMUtils(unsigned int target, bool *supported)
|
|||||||
cmd = virCommandNewArgList("pm-is-supported", "--suspend-hybrid", NULL);
|
cmd = virCommandNewArgList("pm-is-supported", "--suspend-hybrid", NULL);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return ret;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virCommandRun(cmd, &status) < 0)
|
if (virCommandRun(cmd, &status) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check return code of command == 0 for success
|
* Check return code of command == 0 for success
|
||||||
* (i.e., the PM capability is supported)
|
* (i.e., the PM capability is supported)
|
||||||
*/
|
*/
|
||||||
*supported = (status == 0);
|
*supported = (status == 0);
|
||||||
ret = 0;
|
|
||||||
|
|
||||||
cleanup:
|
return 0;
|
||||||
virCommandFree(cmd);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
#else /* ! WITH_PM_UTILS */
|
#else /* ! WITH_PM_UTILS */
|
||||||
static int
|
static int
|
||||||
|
Loading…
Reference in New Issue
Block a user