Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
src/util/virnodesuspend.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/src/util/virnodesuspend.c b/src/util/virnodesuspend.c
index 451d798363..c92232dfe9 100644
--- a/src/util/virnodesuspend.c
+++ b/src/util/virnodesuspend.c
@@ -73,8 +73,7 @@ static void virNodeSuspendUnlock(void)
*/
static int virNodeSuspendSetNodeWakeup(unsigned long long alarmTime)
{
- virCommand *setAlarmCmd;
- int ret = -1;
+ g_autoptr(virCommand) setAlarmCmd = NULL;
if (alarmTime < MIN_TIME_REQ_FOR_SUSPEND) {
virReportError(VIR_ERR_INVALID_ARG,
@@ -86,14 +85,7 @@ static int virNodeSuspendSetNodeWakeup(unsigned long long alarmTime)
setAlarmCmd = virCommandNewArgList("rtcwake", "-m",
"no", "-s", NULL);
virCommandAddArgFormat(setAlarmCmd, "%lld", alarmTime);
- if (virCommandRun(setAlarmCmd, NULL) < 0)
- goto cleanup;
-
- ret = 0;
-
- cleanup:
- virCommandFree(setAlarmCmd);
- return ret;
+ return virCommandRun(setAlarmCmd, NULL);
}
/**
--
2.31.1