aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb/cdc_ether.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/usb/cdc_ether.c')
-rw-r--r--drivers/net/usb/cdc_ether.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 7ec24c9b2535..de3e36596779 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -37,23 +37,23 @@
37 37
38static int is_rndis(struct usb_interface_descriptor *desc) 38static int is_rndis(struct usb_interface_descriptor *desc)
39{ 39{
40 return desc->bInterfaceClass == USB_CLASS_COMM 40 return (desc->bInterfaceClass == USB_CLASS_COMM &&
41 && desc->bInterfaceSubClass == 2 41 desc->bInterfaceSubClass == 2 &&
42 && desc->bInterfaceProtocol == 0xff; 42 desc->bInterfaceProtocol == 0xff);
43} 43}
44 44
45static int is_activesync(struct usb_interface_descriptor *desc) 45static int is_activesync(struct usb_interface_descriptor *desc)
46{ 46{
47 return desc->bInterfaceClass == USB_CLASS_MISC 47 return (desc->bInterfaceClass == USB_CLASS_MISC &&
48 && desc->bInterfaceSubClass == 1 48 desc->bInterfaceSubClass == 1 &&
49 && desc->bInterfaceProtocol == 1; 49 desc->bInterfaceProtocol == 1);
50} 50}
51 51
52static int is_wireless_rndis(struct usb_interface_descriptor *desc) 52static int is_wireless_rndis(struct usb_interface_descriptor *desc)
53{ 53{
54 return desc->bInterfaceClass == USB_CLASS_WIRELESS_CONTROLLER 54 return (desc->bInterfaceClass == USB_CLASS_WIRELESS_CONTROLLER &&
55 && desc->bInterfaceSubClass == 1 55 desc->bInterfaceSubClass == 1 &&
56 && desc->bInterfaceProtocol == 3; 56 desc->bInterfaceProtocol == 3);
57} 57}
58 58
59#else 59#else
@@ -116,9 +116,9 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
116 /* this assumes that if there's a non-RNDIS vendor variant 116 /* this assumes that if there's a non-RNDIS vendor variant
117 * of cdc-acm, it'll fail RNDIS requests cleanly. 117 * of cdc-acm, it'll fail RNDIS requests cleanly.
118 */ 118 */
119 rndis = is_rndis(&intf->cur_altsetting->desc) 119 rndis = (is_rndis(&intf->cur_altsetting->desc) ||
120 || is_activesync(&intf->cur_altsetting->desc) 120 is_activesync(&intf->cur_altsetting->desc) ||
121 || is_wireless_rndis(&intf->cur_altsetting->desc); 121 is_wireless_rndis(&intf->cur_altsetting->desc));
122 122
123 memset(info, 0, sizeof *info); 123 memset(info, 0, sizeof *info);
124 info->control = intf; 124 info->control = intf;
@@ -279,10 +279,10 @@ next_desc:
279 279
280 dev->status = &info->control->cur_altsetting->endpoint [0]; 280 dev->status = &info->control->cur_altsetting->endpoint [0];
281 desc = &dev->status->desc; 281 desc = &dev->status->desc;
282 if (!usb_endpoint_is_int_in(desc) 282 if (!usb_endpoint_is_int_in(desc) ||
283 || (le16_to_cpu(desc->wMaxPacketSize) 283 (le16_to_cpu(desc->wMaxPacketSize)
284 < sizeof(struct usb_cdc_notification)) 284 < sizeof(struct usb_cdc_notification)) ||
285 || !desc->bInterval) { 285 !desc->bInterval) {
286 dev_dbg(&intf->dev, "bad notification endpoint\n"); 286 dev_dbg(&intf->dev, "bad notification endpoint\n");
287 dev->status = NULL; 287 dev->status = NULL;
288 } 288 }