提交 7f5b43b0 编写于 作者: J Ján Tomko

util: use VIR_AUTOPTR virNodeSuspendSupportsTargetPMUtils

Get rid of the ret variable as well as the cleanup label.
Signed-off-by: NJán Tomko <jtomko@redhat.com>
Reviewed-by: NAndrea Bolognani <abologna@redhat.com>
上级 4514abbd
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册