From 931d3c7f30cec21962ba14746767b0b021fb9051 Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Thu, 16 Sep 2021 20:33:05 +0200 Subject: [PATCH] Add visible error on missing uw interface read/write attempt --- src/uniwill_keyboard.h | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/uniwill_keyboard.h b/src/uniwill_keyboard.h index 16243b2..db89606 100644 --- a/src/uniwill_keyboard.h +++ b/src/uniwill_keyboard.h @@ -97,23 +97,31 @@ uniwill_event_callb_t uniwill_event_callb; u32 uniwill_read_ec_ram(u16 address, u8 *data) { - if (!IS_ERR_OR_NULL(uniwill_interfaces.wmi)) - uniwill_interfaces.wmi->read_ec_ram(address, data); - else - return -EIO; + u32 status; - return 0; + if (!IS_ERR_OR_NULL(uniwill_interfaces.wmi)) + status = uniwill_interfaces.wmi->read_ec_ram(address, data); + else { + pr_err("no active interface while read addr 0x%04x\n", address); + status = -EIO; + } + + return status; } EXPORT_SYMBOL(uniwill_read_ec_ram); u32 uniwill_write_ec_ram(u16 address, u8 data) { - if (!IS_ERR_OR_NULL(uniwill_interfaces.wmi)) - uniwill_interfaces.wmi->write_ec_ram(address, data); - else - return -EIO; + u32 status; - return 0; + if (!IS_ERR_OR_NULL(uniwill_interfaces.wmi)) + status = uniwill_interfaces.wmi->write_ec_ram(address, data); + else { + pr_err("no active interface while write addr 0x%04x data 0x%02x\n", address, data); + status = -EIO; + } + + return status; } EXPORT_SYMBOL(uniwill_write_ec_ram);