From 1db22485982467cb1f3e3a92d1ce335839dc27a2 Mon Sep 17 00:00:00 2001 From: Yunhee Seo Date: Fri, 27 Jan 2023 10:35:06 +0900 Subject: [PATCH] tools: devicectl: add handling code to return check Add handling code to resolve issue reported by static analysis. Change-Id: I357c4169783b51423c6216a8b7808fbc051bce44 Signed-off-by: Yunhee Seo --- tools/devicectl/devicectl.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tools/devicectl/devicectl.c b/tools/devicectl/devicectl.c index 456cd42..be8f063 100644 --- a/tools/devicectl/devicectl.c +++ b/tools/devicectl/devicectl.c @@ -417,25 +417,37 @@ out: static int power_suspend(char **args) { - gdbus_call_sync_with_reply(DEVICED_BUS_NAME, + int ret; + ret = gdbus_call_sync_with_reply(DEVICED_BUS_NAME, DEVICED_PATH_POWER, DEVICED_INTERFACE_POWER, "PowerChangeStateWithReason", g_variant_new("(ti)", DEVICED_POWER_STATE_SLEEP, atoi(args[3])), NULL); + if (ret < 0) { + _E("Failed to call dbus method PowerChangeStateWithReason"); + return ret; + } + return 0; } static int power_resume(char **args) { - gdbus_call_sync_with_reply(DEVICED_BUS_NAME, + int ret; + ret = gdbus_call_sync_with_reply(DEVICED_BUS_NAME, DEVICED_PATH_POWER, DEVICED_INTERFACE_POWER, "PowerChangeStateWithReason", g_variant_new("(ti)", DEVICED_POWER_STATE_NORMAL, atoi(args[3])), NULL); + if (ret < 0) { + _E("Failed to call dbus method PowerChangeStateWithReason"); + return ret; + } + return 0; } -- 2.7.4