linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] w35und: fix usb_control_msg() error handling in wb35_probe()
@ 2009-01-22 10:06 Pekka J Enberg
  2009-01-22 11:42 ` Pavel Machek
  2009-01-26 17:51 ` Greg KH
  0 siblings, 2 replies; 20+ messages in thread
From: Pekka J Enberg @ 2009-01-22 10:06 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Pavel Machek, Sandro Bonazzola, linux-kernel

From: Pekka Enberg <penberg@cs.helsinki.fi>

If successful, the usb_control_msg() function returns the number of
bytes transferred. Fix up wb35_probe() to only bail out if the function
returns a negative number.

Reported-by: Sandro Bonazzola <sandro.bonazzola@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
 drivers/staging/winbond/wbusb.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/winbond/wbusb.c b/drivers/staging/winbond/wbusb.c
index fd5c8eb..7ced028 100644
--- a/drivers/staging/winbond/wbusb.c
+++ b/drivers/staging/winbond/wbusb.c
@@ -302,17 +302,19 @@ static int wb35_probe(struct usb_interface *intf,
 	struct usb_device *udev = interface_to_usbdev(intf);
 	struct wbsoft_priv *priv;
 	struct ieee80211_hw *dev;
-	int err;
+	int err, nr;
 
 	usb_get_dev(udev);
 
 	/* Check if the device has already been opened */
-	err = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
-			      0x01,
-			      USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
-			      0x0, 0x400, &ltmp, 4, HZ * 100);
-	if (err)
+	nr = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
+			     0x01,
+			     USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
+			     0x0, 0x400, &ltmp, 4, HZ * 100);
+	if (nr < 0) {
+		err = nr;
 		goto error;
+	}
 
 	/* Is already initialized? */
 	ltmp = cpu_to_le32(ltmp);
-- 
1.5.6.4


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

end of thread, other threads:[~2009-01-30  9:33 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-22 10:06 [PATCH] w35und: fix usb_control_msg() error handling in wb35_probe() Pekka J Enberg
2009-01-22 11:42 ` Pavel Machek
2009-01-22 19:25   ` Sandro Bonazzola
2009-01-22 21:10     ` Pavel Machek
2009-01-22 21:19       ` Harvey Harrison
2009-01-22 22:32         ` Pekka Enberg
2009-01-22 22:34       ` Sandro Bonazzola
2009-01-22 22:31         ` Pekka Enberg
2009-01-26 19:31           ` Sandro Bonazzola
2009-01-26 19:40             ` Pekka Enberg
2009-01-26 19:43               ` Pekka Enberg
2009-01-26 20:13                 ` Sandro Bonazzola
2009-01-26 20:22                   ` Pekka Enberg
2009-01-26 21:42             ` Pavel Machek
2009-01-22 22:37     ` Pekka Enberg
2009-01-26 17:51 ` Greg KH
2009-01-26 18:03   ` Pekka Enberg
2009-01-26 18:10     ` Pekka Enberg
2009-01-29 19:24       ` Greg KH
2009-01-30  9:32         ` Pekka Enberg

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).