linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] HID: fix an error code in hid_check_device_match()
@ 2023-06-06  8:20 Dan Carpenter
  2023-06-06  8:50 ` Benjamin Tissoires
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dan Carpenter @ 2023-06-06  8:20 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Jiri Kosina, Benjamin Tissoires, linux-input, kernel-janitors

The hid_check_device_match() returns true if we find a match and false
if we don't.  But here it returns -ENODEV which becomes true instead
of false.

Fixes: 207733f92661 ("HID: split apart hid_device_probe to make logic more apparent")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/hid/hid-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 4b7062dcefec..8992e3c1e769 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -2593,7 +2593,7 @@ static bool hid_check_device_match(struct hid_device *hdev,
 {
 	*id = hid_match_device(hdev, hdrv);
 	if (!*id)
-		return -ENODEV;
+		return false;
 
 	if (hdrv->match)
 		return hdrv->match(hdev, hid_ignore_special_drivers);
-- 
2.30.2


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

* Re: [PATCH] HID: fix an error code in hid_check_device_match()
  2023-06-06  8:20 [PATCH] HID: fix an error code in hid_check_device_match() Dan Carpenter
@ 2023-06-06  8:50 ` Benjamin Tissoires
  2023-06-06 17:19 ` Dmitry Torokhov
  2023-06-08 15:01 ` Jiri Kosina
  2 siblings, 0 replies; 4+ messages in thread
From: Benjamin Tissoires @ 2023-06-06  8:50 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Dmitry Torokhov, Jiri Kosina, linux-input, kernel-janitors


On Jun 06 2023, Dan Carpenter wrote:
> 
> The hid_check_device_match() returns true if we find a match and false
> if we don't.  But here it returns -ENODEV which becomes true instead
> of false.
> 
> Fixes: 207733f92661 ("HID: split apart hid_device_probe to make logic more apparent")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>  drivers/hid/hid-core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
> index 4b7062dcefec..8992e3c1e769 100644
> --- a/drivers/hid/hid-core.c
> +++ b/drivers/hid/hid-core.c
> @@ -2593,7 +2593,7 @@ static bool hid_check_device_match(struct hid_device *hdev,
>  {
>  	*id = hid_match_device(hdev, hdrv);
>  	if (!*id)
> -		return -ENODEV;
> +		return false;

Thanks for spotting this!

Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Cheers,
Benjamin

>  
>  	if (hdrv->match)
>  		return hdrv->match(hdev, hid_ignore_special_drivers);
> -- 
> 2.30.2
> 


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

* Re: [PATCH] HID: fix an error code in hid_check_device_match()
  2023-06-06  8:20 [PATCH] HID: fix an error code in hid_check_device_match() Dan Carpenter
  2023-06-06  8:50 ` Benjamin Tissoires
@ 2023-06-06 17:19 ` Dmitry Torokhov
  2023-06-08 15:01 ` Jiri Kosina
  2 siblings, 0 replies; 4+ messages in thread
From: Dmitry Torokhov @ 2023-06-06 17:19 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Jiri Kosina, Benjamin Tissoires, linux-input, kernel-janitors

On Tue, Jun 06, 2023 at 11:20:54AM +0300, Dan Carpenter wrote:
> The hid_check_device_match() returns true if we find a match and false
> if we don't.  But here it returns -ENODEV which becomes true instead
> of false.
> 
> Fixes: 207733f92661 ("HID: split apart hid_device_probe to make logic more apparent")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>  drivers/hid/hid-core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
> index 4b7062dcefec..8992e3c1e769 100644
> --- a/drivers/hid/hid-core.c
> +++ b/drivers/hid/hid-core.c
> @@ -2593,7 +2593,7 @@ static bool hid_check_device_match(struct hid_device *hdev,
>  {
>  	*id = hid_match_device(hdev, hdrv);
>  	if (!*id)
> -		return -ENODEV;
> +		return false;

Ugh, I goofed up, thank you for noticing this Dan.

Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Thanks.

-- 
Dmitry

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

* Re: [PATCH] HID: fix an error code in hid_check_device_match()
  2023-06-06  8:20 [PATCH] HID: fix an error code in hid_check_device_match() Dan Carpenter
  2023-06-06  8:50 ` Benjamin Tissoires
  2023-06-06 17:19 ` Dmitry Torokhov
@ 2023-06-08 15:01 ` Jiri Kosina
  2 siblings, 0 replies; 4+ messages in thread
From: Jiri Kosina @ 2023-06-08 15:01 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Dmitry Torokhov, Benjamin Tissoires, linux-input, kernel-janitors

On Tue, 6 Jun 2023, Dan Carpenter wrote:

> The hid_check_device_match() returns true if we find a match and false
> if we don't.  But here it returns -ENODEV which becomes true instead
> of false.
> 
> Fixes: 207733f92661 ("HID: split apart hid_device_probe to make logic more apparent")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>  drivers/hid/hid-core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
> index 4b7062dcefec..8992e3c1e769 100644
> --- a/drivers/hid/hid-core.c
> +++ b/drivers/hid/hid-core.c
> @@ -2593,7 +2593,7 @@ static bool hid_check_device_match(struct hid_device *hdev,
>  {
>  	*id = hid_match_device(hdev, hdrv);
>  	if (!*id)
> -		return -ENODEV;
> +		return false;
>  
>  	if (hdrv->match)
>  		return hdrv->match(hdev, hid_ignore_special_drivers);

Thanks for checking this! Applied.

-- 
Jiri Kosina
SUSE Labs


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

end of thread, other threads:[~2023-06-08 15:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-06  8:20 [PATCH] HID: fix an error code in hid_check_device_match() Dan Carpenter
2023-06-06  8:50 ` Benjamin Tissoires
2023-06-06 17:19 ` Dmitry Torokhov
2023-06-08 15:01 ` Jiri Kosina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).