Skip to contentSkip to conversation

HID: fix an error code in hid_check_device_match()

PATCH In review Dan Carpenter 4 participants 4 messages Jun 6, 2023 – Jun 8, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 HID: fix an error code in hid_check_device_match()

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")
---
 drivers/hid/hid-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-core.c +1 -1
index 4b7062dcefec..8992e3c1e769 100644
@@ -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);
Signature · 1 line
2.30.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Dan Carpenter

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")
---
 drivers/hid/hid-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-core.c +0 -0
index 4b7062dcefec..8992e3c1e769 100644

drivers/hid/hid-core.c static bool hid_check_device_match(struct hid_device *hdev, · line 2596

Quoted 5 lines
drivers/hid/hid-core.c +1 -1
@@ -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!

Cheers,
Benjamin

Quoted 6 lines
drivers/hid/hid-core.c +0 -0
 	if (hdrv->match)
 		return hdrv->match(hdev, hid_ignore_special_drivers);
Signature · 1 line
2.30.2
Reviewed-by on v1 1/1
#2 lore raw
In reply to Dan Carpenter
Quoted 15 lines · Dan Carpenter

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")
---
 drivers/hid/hid-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-core.c +0 -0
index 4b7062dcefec..8992e3c1e769 100644

drivers/hid/hid-core.c static bool hid_check_device_match(struct hid_device *hdev, · line 2596

Quoted 5 lines
drivers/hid/hid-core.c +1 -1
@@ -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.

Thanks.

Signature · 1 line
Dmitry
maintainer
#3 lore raw
In reply to Dan Carpenter
Quoted 15 lines · Dan Carpenter

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")
---
 drivers/hid/hid-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-core.c +0 -0
index 4b7062dcefec..8992e3c1e769 100644

drivers/hid/hid-core.c static bool hid_check_device_match(struct hid_device *hdev, · line 2599

Quoted 8 lines
drivers/hid/hid-core.c +1 -1
@@ -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.

Signature · 2 lines
Jiri Kosina
SUSE Labs