[PATCH] Input: cm109 - fix checking return value of usb_control_msg

Subsystems: input (keyboard, mouse, joystick, touchscreen) drivers, the rest

STALE5518d

2 messages, 2 authors, 2011-08-27 · open the first message on its own page

[PATCH] Input: cm109 - fix checking return value of usb_control_msg

From: Axel Lin <hidden>
Date: 2011-08-25 14:07:11

If successful, usb_control_msg returns the number of bytes transferred,
otherwise a negative error number.

Signed-off-by: Axel Lin <redacted>
---
 drivers/input/misc/cm109.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/input/misc/cm109.c b/drivers/input/misc/cm109.c
index b09c7d1..b741338 100644
--- a/drivers/input/misc/cm109.c
+++ b/drivers/input/misc/cm109.c
@@ -475,7 +475,7 @@ static void cm109_toggle_buzzer_sync(struct cm109_dev *dev, int on)
 				le16_to_cpu(dev->ctl_req->wIndex),
 				dev->ctl_data,
 				USB_PKT_LEN, USB_CTRL_SET_TIMEOUT);
-	if (error && error != EINTR)
+	if ((error < 0) && (error != -EINTR))
 		err("%s: usb_control_msg() failed %d", __func__, error);
 }
 
-- 
1.7.4.1

Re: [PATCH] Input: cm109 - fix checking return value of usb_control_msg

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2011-08-27 06:29:49

On Thu, Aug 25, 2011 at 10:06:50PM +0800, Axel Lin wrote:
If successful, usb_control_msg returns the number of bytes transferred,
otherwise a negative error number.

Signed-off-by: Axel Lin <redacted>
Applied, thanks Axel.

-- 
Dmitry
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help