All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] platform/x86: wmi: Fix wmi_dev_probe()
@ 2024-01-05 13:47 Dan Carpenter
  2024-01-06 22:04 ` Armin Wolf
  2024-01-08 14:55 ` Hans de Goede
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2024-01-05 13:47 UTC (permalink / raw)
  To: Armin Wolf
  Cc: Hans de Goede, Ilpo Järvinen, platform-driver-x86,
	linux-kernel, kernel-janitors

This has a reversed if statement so it accidentally disables the wmi
method before returning.

Fixes: 704af3a40747 ("platform/x86: wmi: Remove chardev interface")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/platform/x86/wmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index 157f1ce8ac0a..e6f6fa2fd080 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -868,7 +868,7 @@ static int wmi_dev_probe(struct device *dev)
 	if (wdriver->probe) {
 		ret = wdriver->probe(dev_to_wdev(dev),
 				find_guid_context(wblock, wdriver));
-		if (!ret) {
+		if (ret) {
 			if (ACPI_FAILURE(wmi_method_enable(wblock, false)))
 				dev_warn(dev, "Failed to disable device\n");
 
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] platform/x86: wmi: Fix wmi_dev_probe()
  2024-01-05 13:47 [PATCH] platform/x86: wmi: Fix wmi_dev_probe() Dan Carpenter
@ 2024-01-06 22:04 ` Armin Wolf
  2024-01-08 14:55 ` Hans de Goede
  1 sibling, 0 replies; 3+ messages in thread
From: Armin Wolf @ 2024-01-06 22:04 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Hans de Goede, Ilpo Järvinen, platform-driver-x86,
	linux-kernel, kernel-janitors

Am 05.01.24 um 14:47 schrieb Dan Carpenter:

> This has a reversed if statement so it accidentally disables the wmi
> method before returning.

Good catch, you are absolutely right!
And on top of that it also breaks WMI event drivers since the WMI_PROBED
flag will not be set when the driver successfully probes and instead will
be set when the driver fails to probe.

For the patch:
Reviewed-by: Armin Wolf <W_Armin@gmx.de>

Thanks,
Armin Wolf

>
> Fixes: 704af3a40747 ("platform/x86: wmi: Remove chardev interface")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>   drivers/platform/x86/wmi.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
> index 157f1ce8ac0a..e6f6fa2fd080 100644
> --- a/drivers/platform/x86/wmi.c
> +++ b/drivers/platform/x86/wmi.c
> @@ -868,7 +868,7 @@ static int wmi_dev_probe(struct device *dev)
>   	if (wdriver->probe) {
>   		ret = wdriver->probe(dev_to_wdev(dev),
>   				find_guid_context(wblock, wdriver));
> -		if (!ret) {
> +		if (ret) {
>   			if (ACPI_FAILURE(wmi_method_enable(wblock, false)))
>   				dev_warn(dev, "Failed to disable device\n");
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] platform/x86: wmi: Fix wmi_dev_probe()
  2024-01-05 13:47 [PATCH] platform/x86: wmi: Fix wmi_dev_probe() Dan Carpenter
  2024-01-06 22:04 ` Armin Wolf
@ 2024-01-08 14:55 ` Hans de Goede
  1 sibling, 0 replies; 3+ messages in thread
From: Hans de Goede @ 2024-01-08 14:55 UTC (permalink / raw)
  To: Dan Carpenter, Armin Wolf
  Cc: Ilpo Järvinen, platform-driver-x86, linux-kernel, kernel-janitors

Hi,

On 1/5/24 14:47, Dan Carpenter wrote:
> This has a reversed if statement so it accidentally disables the wmi
> method before returning.
> 
> Fixes: 704af3a40747 ("platform/x86: wmi: Remove chardev interface")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Thank you for your patch, I've applied this patch to my review-hans 
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.

I will include this patch in my next fixes pull-req to Linus
for the current kernel development cycle.

Regards,

Hans


> ---
>  drivers/platform/x86/wmi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
> index 157f1ce8ac0a..e6f6fa2fd080 100644
> --- a/drivers/platform/x86/wmi.c
> +++ b/drivers/platform/x86/wmi.c
> @@ -868,7 +868,7 @@ static int wmi_dev_probe(struct device *dev)
>  	if (wdriver->probe) {
>  		ret = wdriver->probe(dev_to_wdev(dev),
>  				find_guid_context(wblock, wdriver));
> -		if (!ret) {
> +		if (ret) {
>  			if (ACPI_FAILURE(wmi_method_enable(wblock, false)))
>  				dev_warn(dev, "Failed to disable device\n");
>  


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-01-08 14:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-05 13:47 [PATCH] platform/x86: wmi: Fix wmi_dev_probe() Dan Carpenter
2024-01-06 22:04 ` Armin Wolf
2024-01-08 14:55 ` Hans de Goede

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.