diff mbox series

[SRU,J,1/1] platform/x86: hp-wmi: Fix hp_wmi_read_int() reporting error (0x05)

Message ID 20220617111923.64110-2-andy.chi@canonical.com
State New
Headers show
Series [SRU,J,1/1] platform/x86: hp-wmi: Fix hp_wmi_read_int() reporting error (0x05) | expand

Commit Message

Andy Chi June 17, 2022, 11:19 a.m. UTC
From: Jorge Lopez <jorge.lopez2@hp.com>

BugLink: http://bugs.launchpad.net/bugs/1979051

The purpose of this patch is to introduce a fix to hp_wmi_read_int()
and eliminate failure error (0x05). Several WMI queries leverage
hp_wmi_read_int() to read their data and were failing with error 0x05.

HPWMI_DISPLAY_QUERY
HPWMI_HDDTEMP_QUERY
HPWMI_ALS_QUERY
HPWMI_HARDWARE_QUERY
HPWMI_WIRELESS_QUERY
HPWMI_POSTCODEERROR_QUERY

The failure occurs because hp_wmi_read_int() calls
hp_wmi_perform_query() with input parameter of size greater than zero.
Invoking those WMI commands with an input buffer size greater than
zero causes the command to be rejected and error 0x05 be returned.

All changes were validated on a HP ZBook Workstation notebook,
HP EliteBook x360, and HP EliteBook 850 G8.

Signed-off-by: Jorge Lopez <jorge.lopez2@hp.com>
Link: https://lore.kernel.org/r/20220310210853.28367-2-jorge.lopez2@hp.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 12b19f14a21a2ee6348825d95b642ef2cd16794f)
Signed-off-by: Andy Chi <andy.chi@canonical.com>
---
 drivers/platform/x86/hp-wmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stefan Bader June 21, 2022, 5:44 p.m. UTC | #1
On 17.06.22 13:19, Andy Chi wrote:
> From: Jorge Lopez <jorge.lopez2@hp.com>
> 
> BugLink: http://bugs.launchpad.net/bugs/1979051
> 
> The purpose of this patch is to introduce a fix to hp_wmi_read_int()
> and eliminate failure error (0x05). Several WMI queries leverage
> hp_wmi_read_int() to read their data and were failing with error 0x05.
> 
> HPWMI_DISPLAY_QUERY
> HPWMI_HDDTEMP_QUERY
> HPWMI_ALS_QUERY
> HPWMI_HARDWARE_QUERY
> HPWMI_WIRELESS_QUERY
> HPWMI_POSTCODEERROR_QUERY
> 
> The failure occurs because hp_wmi_read_int() calls
> hp_wmi_perform_query() with input parameter of size greater than zero.
> Invoking those WMI commands with an input buffer size greater than
> zero causes the command to be rejected and error 0x05 be returned.
> 
> All changes were validated on a HP ZBook Workstation notebook,
> HP EliteBook x360, and HP EliteBook 850 G8.
> 
> Signed-off-by: Jorge Lopez <jorge.lopez2@hp.com>
> Link: https://lore.kernel.org/r/20220310210853.28367-2-jorge.lopez2@hp.com
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> (cherry picked from commit 12b19f14a21a2ee6348825d95b642ef2cd16794f)
> Signed-off-by: Andy Chi <andy.chi@canonical.com>
> ---

Applied to jammy:linux/master-next. Thanks.

-Stefan

>   drivers/platform/x86/hp-wmi.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
> index 027a1467d009..0495a31a9cee 100644
> --- a/drivers/platform/x86/hp-wmi.c
> +++ b/drivers/platform/x86/hp-wmi.c
> @@ -284,7 +284,7 @@ static int hp_wmi_read_int(int query)
>   	int val = 0, ret;
>   
>   	ret = hp_wmi_perform_query(query, HPWMI_READ, &val,
> -				   sizeof(val), sizeof(val));
> +				   0, sizeof(val));
>   
>   	if (ret)
>   		return ret < 0 ? ret : -EINVAL;
diff mbox series

Patch

diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
index 027a1467d009..0495a31a9cee 100644
--- a/drivers/platform/x86/hp-wmi.c
+++ b/drivers/platform/x86/hp-wmi.c
@@ -284,7 +284,7 @@  static int hp_wmi_read_int(int query)
 	int val = 0, ret;
 
 	ret = hp_wmi_perform_query(query, HPWMI_READ, &val,
-				   sizeof(val), sizeof(val));
+				   0, sizeof(val));
 
 	if (ret)
 		return ret < 0 ? ret : -EINVAL;