aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2011-03-13 01:54:31 -0500
committerDavid S. Miller <davem@davemloft.net>2011-03-14 18:24:18 -0400
commit468c3f924f043cad7a04f4f4d5224a2c9bc886c1 (patch)
tree124213e020ed944cb879165a8f6233aff1066182 /drivers/net/usb
parentac90fa63432b3c03c189c39e62211d3b80418c30 (diff)
NET: cdc-phonet, handle empty phonet header
Currently, for N 5800 XM I get: cdc_phonet: probe of 1-6:1.10 failed with error -22 It's because phonet_header is empty. Extra altsetting looks like there: E 05 24 00 01 10 03 24 ab 05 24 06 0a 0b 04 24 fd .$....$..$....$. E 00 . I don't see the header used anywhere so just check if the phonet descriptor is there, not the structure itself. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Cc: Rémi Denis-Courmont <remi.denis-courmont@nokia.com> Cc: David S. Miller <davem@davemloft.net> Acked-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb')
-rw-r--r--drivers/net/usb/cdc-phonet.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/net/usb/cdc-phonet.c b/drivers/net/usb/cdc-phonet.c
index 4cf4e361c121..f967913e11bc 100644
--- a/drivers/net/usb/cdc-phonet.c
+++ b/drivers/net/usb/cdc-phonet.c
@@ -328,13 +328,13 @@ int usbpn_probe(struct usb_interface *intf, const struct usb_device_id *id)
328{ 328{
329 static const char ifname[] = "usbpn%d"; 329 static const char ifname[] = "usbpn%d";
330 const struct usb_cdc_union_desc *union_header = NULL; 330 const struct usb_cdc_union_desc *union_header = NULL;
331 const struct usb_cdc_header_desc *phonet_header = NULL;
332 const struct usb_host_interface *data_desc; 331 const struct usb_host_interface *data_desc;
333 struct usb_interface *data_intf; 332 struct usb_interface *data_intf;
334 struct usb_device *usbdev = interface_to_usbdev(intf); 333 struct usb_device *usbdev = interface_to_usbdev(intf);
335 struct net_device *dev; 334 struct net_device *dev;
336 struct usbpn_dev *pnd; 335 struct usbpn_dev *pnd;
337 u8 *data; 336 u8 *data;
337 int phonet = 0;
338 int len, err; 338 int len, err;
339 339
340 data = intf->altsetting->extra; 340 data = intf->altsetting->extra;
@@ -355,10 +355,7 @@ int usbpn_probe(struct usb_interface *intf, const struct usb_device_id *id)
355 (struct usb_cdc_union_desc *)data; 355 (struct usb_cdc_union_desc *)data;
356 break; 356 break;
357 case 0xAB: 357 case 0xAB:
358 if (phonet_header || dlen < 5) 358 phonet = 1;
359 break;
360 phonet_header =
361 (struct usb_cdc_header_desc *)data;
362 break; 359 break;
363 } 360 }
364 } 361 }
@@ -366,7 +363,7 @@ int usbpn_probe(struct usb_interface *intf, const struct usb_device_id *id)
366 len -= dlen; 363 len -= dlen;
367 } 364 }
368 365
369 if (!union_header || !phonet_header) 366 if (!union_header || !phonet)
370 return -EINVAL; 367 return -EINVAL;
371 368
372 data_intf = usb_ifnum_to_if(usbdev, union_header->bSlaveInterface0); 369 data_intf = usb_ifnum_to_if(usbdev, union_header->bSlaveInterface0);