tools: devicectl: add handling code to return check accepted/tizen/7.0/unified/20230203.164113
authorYunhee Seo <yuni.seo@samsung.com>
Fri, 27 Jan 2023 01:35:06 +0000 (10:35 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Fri, 27 Jan 2023 03:30:39 +0000 (12:30 +0900)
Add handling code to resolve issue reported by static analysis.

Change-Id: I357c4169783b51423c6216a8b7808fbc051bce44
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
(cherry picked from commit 1db22485982467cb1f3e3a92d1ce335839dc27a2)

tools/devicectl/devicectl.c

index 456cd42..be8f063 100644 (file)
@@ -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;
 }