From 20a72263b2a10f0e75df18bc0cbda473e728826c Mon Sep 17 00:00:00 2001 From: DoctorNefario <5243039+DoctorNefario@users.noreply.github.com> Date: Thu, 7 Apr 2022 01:00:01 +1000 Subject: [PATCH] fix(behaviors): Prevent accidental transparent behavior return values. Needed because k_work_reschedule can return positive success codes. --- app/src/ext_power_generic.c | 3 ++- app/src/rgb_underglow.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/ext_power_generic.c b/app/src/ext_power_generic.c index 3f83bd95..0743d50d 100644 --- a/app/src/ext_power_generic.c +++ b/app/src/ext_power_generic.c @@ -50,7 +50,8 @@ static struct k_work_delayable ext_power_save_work; int ext_power_save_state() { #if IS_ENABLED(CONFIG_SETTINGS) - return k_work_reschedule(&ext_power_save_work, K_MSEC(CONFIG_ZMK_SETTINGS_SAVE_DEBOUNCE)); + int ret = k_work_reschedule(&ext_power_save_work, K_MSEC(CONFIG_ZMK_SETTINGS_SAVE_DEBOUNCE)); + return MIN(ret, 0); #else return 0; #endif diff --git a/app/src/rgb_underglow.c b/app/src/rgb_underglow.c index b1e2348e..517da1b8 100644 --- a/app/src/rgb_underglow.c +++ b/app/src/rgb_underglow.c @@ -272,7 +272,8 @@ static int zmk_rgb_underglow_init(const struct device *_arg) { int zmk_rgb_underglow_save_state() { #if IS_ENABLED(CONFIG_SETTINGS) - return k_work_reschedule(&underglow_save_work, K_MSEC(CONFIG_ZMK_SETTINGS_SAVE_DEBOUNCE)); + int ret = k_work_reschedule(&underglow_save_work, K_MSEC(CONFIG_ZMK_SETTINGS_SAVE_DEBOUNCE)); + return MIN(ret, 0); #else return 0; #endif