diff options
| author | Pekka Enberg <penberg@cs.helsinki.fi> | 2009-01-30 04:32:47 -0500 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-02-27 15:56:24 -0500 |
| commit | acfa5110b83b171ec509eaf2d1a9e93a5f4709bd (patch) | |
| tree | 8f132828fd627a5bc25b26f42f8cb8281606401f /drivers | |
| parent | 05e361cae5e633c2b58967d1444cf6ae56662e5c (diff) | |
Staging: w35und: fix usb_control_msg() error handling in wb35_probe()
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. Also, fix up ieee80211_alloc_hw() error code to ENOMEM;
otherwise GCC complains that err might be undefined (and is right about that).
Acked-by: Pavel Machek <pavel@suse.cz>
Reported-and-tested-by: Sandro Bonazzola <sandro.bonazzola@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/staging/winbond/wbusb.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/staging/winbond/wbusb.c b/drivers/staging/winbond/wbusb.c index 49f1bf0acfb0..f716b2e92b65 100644 --- a/drivers/staging/winbond/wbusb.c +++ b/drivers/staging/winbond/wbusb.c | |||
| @@ -319,16 +319,18 @@ static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
| 319 | struct usb_device *udev = interface_to_usbdev(intf); | 319 | struct usb_device *udev = interface_to_usbdev(intf); |
| 320 | struct wbsoft_priv *priv; | 320 | struct wbsoft_priv *priv; |
| 321 | struct ieee80211_hw *dev; | 321 | struct ieee80211_hw *dev; |
| 322 | int err; | 322 | int nr, err; |
| 323 | 323 | ||
| 324 | usb_get_dev(udev); | 324 | usb_get_dev(udev); |
| 325 | 325 | ||
| 326 | // 20060630.2 Check the device if it already be opened | 326 | // 20060630.2 Check the device if it already be opened |
| 327 | err = usb_control_msg(udev, usb_rcvctrlpipe( udev, 0 ), | 327 | nr = usb_control_msg(udev, usb_rcvctrlpipe( udev, 0 ), |
| 328 | 0x01, USB_TYPE_VENDOR|USB_RECIP_DEVICE|USB_DIR_IN, | 328 | 0x01, USB_TYPE_VENDOR|USB_RECIP_DEVICE|USB_DIR_IN, |
| 329 | 0x0, 0x400, <mp, 4, HZ*100 ); | 329 | 0x0, 0x400, <mp, 4, HZ*100 ); |
| 330 | if (err) | 330 | if (nr < 0) { |
| 331 | err = nr; | ||
| 331 | goto error; | 332 | goto error; |
| 333 | } | ||
| 332 | 334 | ||
| 333 | ltmp = cpu_to_le32(ltmp); | 335 | ltmp = cpu_to_le32(ltmp); |
| 334 | if (ltmp) { // Is already initialized? | 336 | if (ltmp) { // Is already initialized? |
| @@ -337,8 +339,10 @@ static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
| 337 | } | 339 | } |
| 338 | 340 | ||
| 339 | dev = ieee80211_alloc_hw(sizeof(*priv), &wbsoft_ops); | 341 | dev = ieee80211_alloc_hw(sizeof(*priv), &wbsoft_ops); |
| 340 | if (!dev) | 342 | if (!dev) { |
| 343 | err = -ENOMEM; | ||
| 341 | goto error; | 344 | goto error; |
| 345 | } | ||
| 342 | 346 | ||
| 343 | priv = dev->priv; | 347 | priv = dev->priv; |
| 344 | 348 | ||
