* [PATCH 1/1] input: usbhid: fix improper check
@ 2016-12-04 5:10 Pan Bian
2016-12-05 9:07 ` Oliver Neukum
0 siblings, 1 reply; 2+ messages in thread
From: Pan Bian @ 2016-12-04 5:10 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, linux-usb, linux-input
Cc: linux-kernel, Pan Bian
From: Pan Bian <bianpan2016@163.com>
Function hid_post_reset() returns 0 on success, or 1 on failures.
However, in function hid_reset_resume(), uses "status >= 0" to check the
return value of hid_post_reset(). Obviously, the condition will always
be satisfied. This patch fixes the bug, uses "status == 0" to check the
return value.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188921
Signed-off-by: Pan Bian <bianpan2016@163.com>
---
drivers/hid/usbhid/hid-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index ae83af6..3639b70 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -1590,7 +1590,7 @@ static int hid_reset_resume(struct usb_interface *intf)
int status;
status = hid_post_reset(intf);
- if (status >= 0 && hid->driver && hid->driver->reset_resume) {
+ if (status == 0 && hid->driver && hid->driver->reset_resume) {
int ret = hid->driver->reset_resume(hid);
if (ret < 0)
status = ret;
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] input: usbhid: fix improper check
2016-12-04 5:10 [PATCH 1/1] input: usbhid: fix improper check Pan Bian
@ 2016-12-05 9:07 ` Oliver Neukum
0 siblings, 0 replies; 2+ messages in thread
From: Oliver Neukum @ 2016-12-05 9:07 UTC (permalink / raw)
To: Pan Bian
Cc: Jiri Kosina, Benjamin Tissoires, linux-input, linux-usb,
Pan Bian, linux-kernel
On Sun, 2016-12-04 at 13:10 +0800, Pan Bian wrote:
> From: Pan Bian <bianpan2016@163.com>
>
> Function hid_post_reset() returns 0 on success, or 1 on failures.
It seems like hid_post_reset() is buggy in not returning
a proper error code in the failure case. So your diagnosis
is right, but the fix is at the wrong place.
Regards
Oliver
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-12-05 9:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-04 5:10 [PATCH 1/1] input: usbhid: fix improper check Pan Bian
2016-12-05 9:07 ` Oliver Neukum
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).