aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Armin Wolf <W_Armin@gmx.de> 2024-03-14 19:45:38 +0100
committerGravatar Hans de Goede <hdegoede@redhat.com> 2024-03-25 15:53:59 +0100
commite526da8f8875267ccb8f4c4782668ebfa160b2c0 (patch)
tree1cb427cc29aa311facee947515d872520f25174c
parentplatform/x86: wmi: Support reading/writing 16 bit EC values (diff)
downloadlinux-e526da8f8875267ccb8f4c4782668ebfa160b2c0.tar.gz
linux-e526da8f8875267ccb8f4c4782668ebfa160b2c0.tar.bz2
linux-e526da8f8875267ccb8f4c4782668ebfa160b2c0.zip
platform/x86: wmi: Avoid returning AE_OK upon unknown error
If an error code other than EINVAL, ENODEV or ETIME is returned by ec_read()/ec_write(), then AE_OK is wrongly returned. Fix this by only returning AE_OK if the return code is 0, and return AE_ERROR otherwise. Tested on a Dell Inspiron 3505 and a Asus Prime B650-Plus. Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> Signed-off-by: Armin Wolf <W_Armin@gmx.de> Link: https://lore.kernel.org/r/20240314184538.2933-2-W_Armin@gmx.de Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r--drivers/platform/x86/wmi.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index 9602658711cf..060e4236f932 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -1217,8 +1217,10 @@ acpi_wmi_ec_space_handler(u32 function, acpi_physical_address address,
return AE_NOT_FOUND;
case -ETIME:
return AE_TIME;
- default:
+ case 0:
return AE_OK;
+ default:
+ return AE_ERROR;
}
}