Patchwork [net-next-2.6] cx82310_eth: check usb_string() return value for error

login
register
mail settings
Submitter Ondrej Zary
Date Sept. 11, 2010, 3:39 p.m.
Message ID <201009111740.00243.linux@rainbow-software.org>
Download mbox | patch
Permalink /patch/64524/
State Accepted
Delegated to: David Miller
Headers show

Comments

Ondrej Zary - Sept. 11, 2010, 3:39 p.m.
Fix that usb_string() return value is not checked for error (negative value).
Also change the ignore message a bit and lower its level to info.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
David Miller - Sept. 14, 2010, 3:04 a.m.
From: Ondrej Zary <linux@rainbow-software.org>
Date: Sat, 11 Sep 2010 17:39:57 +0200

> Fix that usb_string() return value is not checked for error (negative value).
> Also change the ignore message a bit and lower its level to info.
> 
> Signed-off-by: Ondrej Zary <linux@rainbow-software.org>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

--- linux-2.6.36-rc3-/drivers/net/usb/cx82310_eth.c	2010-09-11 17:06:59.000000000 +0200
+++ linux-2.6.36-rc3/drivers/net/usb/cx82310_eth.c	2010-09-11 17:21:22.000000000 +0200
@@ -138,11 +138,9 @@  static int cx82310_bind(struct usbnet *d
 	struct usb_device *udev = dev->udev;
 
 	/* avoid ADSL modems - continue only if iProduct is "USB NET CARD" */
-	if (udev->descriptor.iProduct &&
-	    usb_string(udev, udev->descriptor.iProduct, buf, sizeof(buf)) &&
-	    strcmp(buf, "USB NET CARD")) {
-		dev_err(&udev->dev,
-			"probably an ADSL modem, use cxacru driver instead\n");
+	if (usb_string(udev, udev->descriptor.iProduct, buf, sizeof(buf)) > 0
+	    && strcmp(buf, "USB NET CARD")) {
+		dev_info(&udev->dev, "ignoring: probably an ADSL modem\n");
 		return -ENODEV;
 	}