From 80374812948cd8cdbf1972db84402bf9fc9a75c2 Mon Sep 17 00:00:00 2001 From: Yunhee Seo Date: Mon, 6 Nov 2023 10:46:15 +0900 Subject: [PATCH] power: Add callback parameter check When the callback parameter is null, it causes abnormal operation. To avoid this, callback parameter check is necessary. Change-Id: I5bfdf967ed5abea9563cbe070d8157b47d5ec7b0 Signed-off-by: Yunhee Seo --- src/power-internal.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/power-internal.c b/src/power-internal.c index 631e11a..74d2b1e 100644 --- a/src/power-internal.c +++ b/src/power-internal.c @@ -201,6 +201,9 @@ int device_power_add_state_wait_callback(device_power_state_e state_bits, if (!IS_STATE_BIT(state_bits)) return DEVICE_ERROR_INVALID_PARAMETER; + if (!cb) + return DEVICE_ERROR_INVALID_PARAMETER; + return register_state_signal_callback(state_bits, cb, data); } @@ -312,6 +315,9 @@ int device_power_add_transient_state_wait_callback(device_power_transient_state_ if (!IS_TRANSIENT_STATE_BIT(transient_bits)) return DEVICE_ERROR_INVALID_PARAMETER; + if (!cb) + return DEVICE_ERROR_INVALID_PARAMETER; + return register_transient_state_signal_callback(transient_bits, cb, data); } -- 2.7.4