tools: devicectl: add handling code to return check 33/287333/3 accepted/tizen/unified/20230206.093845 accepted/tizen/unified/20230206.094000
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:00:19 +0000 (03:00 +0000)
Add handling code to resolve issue reported by static analysis.

Change-Id: I357c4169783b51423c6216a8b7808fbc051bce44
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
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;
 }