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>
This commit is contained in:
parent
ac90fa6343
commit
468c3f924f
1 changed files with 3 additions and 6 deletions
|
@ -328,13 +328,13 @@ int usbpn_probe(struct usb_interface *intf, const struct usb_device_id *id)
|
||||||
{
|
{
|
||||||
static const char ifname[] = "usbpn%d";
|
static const char ifname[] = "usbpn%d";
|
||||||
const struct usb_cdc_union_desc *union_header = NULL;
|
const struct usb_cdc_union_desc *union_header = NULL;
|
||||||
const struct usb_cdc_header_desc *phonet_header = NULL;
|
|
||||||
const struct usb_host_interface *data_desc;
|
const struct usb_host_interface *data_desc;
|
||||||
struct usb_interface *data_intf;
|
struct usb_interface *data_intf;
|
||||||
struct usb_device *usbdev = interface_to_usbdev(intf);
|
struct usb_device *usbdev = interface_to_usbdev(intf);
|
||||||
struct net_device *dev;
|
struct net_device *dev;
|
||||||
struct usbpn_dev *pnd;
|
struct usbpn_dev *pnd;
|
||||||
u8 *data;
|
u8 *data;
|
||||||
|
int phonet = 0;
|
||||||
int len, err;
|
int len, err;
|
||||||
|
|
||||||
data = intf->altsetting->extra;
|
data = intf->altsetting->extra;
|
||||||
|
@ -355,10 +355,7 @@ int usbpn_probe(struct usb_interface *intf, const struct usb_device_id *id)
|
||||||
(struct usb_cdc_union_desc *)data;
|
(struct usb_cdc_union_desc *)data;
|
||||||
break;
|
break;
|
||||||
case 0xAB:
|
case 0xAB:
|
||||||
if (phonet_header || dlen < 5)
|
phonet = 1;
|
||||||
break;
|
|
||||||
phonet_header =
|
|
||||||
(struct usb_cdc_header_desc *)data;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -366,7 +363,7 @@ int usbpn_probe(struct usb_interface *intf, const struct usb_device_id *id)
|
||||||
len -= dlen;
|
len -= dlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!union_header || !phonet_header)
|
if (!union_header || !phonet)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
data_intf = usb_ifnum_to_if(usbdev, union_header->bSlaveInterface0);
|
data_intf = usb_ifnum_to_if(usbdev, union_header->bSlaveInterface0);
|
||||||
|
|
Loading…
Add table
Reference in a new issue