From a14e6a02984ed8d2cadf313ca8fbd5003b5b70d0 Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Thu, 16 Feb 2023 17:14:33 +0100 Subject: [PATCH] Fix return values of charging id funcs --- src/uniwill_keyboard.h | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/uniwill_keyboard.h b/src/uniwill_keyboard.h index c17b5cb..d86e21c 100644 --- a/src/uniwill_keyboard.h +++ b/src/uniwill_keyboard.h @@ -808,17 +808,21 @@ static int uw_has_charging_priority(bool *status) || dmi_match(DMI_PRODUCT_NAME, "A60 MUV") ; - if (not_supported_device) - return false; + if (not_supported_device) { + *status = false; + return 0; + } result = uniwill_read_ec_ram(0x0742, &data); + if (result != 0) + return -EIO; if (data & (1 << 5)) *status = true; else *status = false; - return result; + return 0; } static bool uw_charging_profile_loaded = false; @@ -865,17 +869,21 @@ static int uw_has_charging_profile(bool *status) || dmi_match(DMI_PRODUCT_NAME, "A60 MUV") ; - if (not_supported_device) - return false; + if (not_supported_device) { + *status = false; + return 0; + } result = uniwill_read_ec_ram(0x078e, &data); + if (result != 0) + return -EIO; if (data & (1 << 3)) *status = true; else *status = false; - return result; + return 0; } struct char_to_u8_t {