net: cdc_ncm: remove descriptor pointers
authorBjørn Mork <bjorn@mork.no>
Fri, 1 Nov 2013 10:16:47 +0000 (11:16 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sat, 2 Nov 2013 06:02:02 +0000 (02:02 -0400)
header_desc was completely unused and union_desc was never used
outside cdc_ncm_bind_common.

Cc: Alexey Orishko <alexey.orishko@gmail.com>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/usb/cdc_ncm.c
include/linux/usb/cdc_ncm.h

index b8de8ddd6d98fa1c19ea254d9c9363cea5e6d1cd..435fcc75d706b468f1e4eadf2b1c0f45cbfc33a4 100644 (file)
@@ -372,6 +372,7 @@ static const struct ethtool_ops cdc_ncm_ethtool_ops = {
 
 int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting)
 {
+       const struct usb_cdc_union_desc *union_desc = NULL;
        struct cdc_ncm_ctx *ctx;
        struct usb_driver *driver;
        u8 *buf;
@@ -406,16 +407,15 @@ int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_
 
                switch (buf[2]) {
                case USB_CDC_UNION_TYPE:
-                       if (buf[0] < sizeof(*(ctx->union_desc)))
+                       if (buf[0] < sizeof(*union_desc))
                                break;
 
-                       ctx->union_desc =
-                                       (const struct usb_cdc_union_desc *)buf;
+                       union_desc = (const struct usb_cdc_union_desc *)buf;
 
                        ctx->control = usb_ifnum_to_if(dev->udev,
-                                       ctx->union_desc->bMasterInterface0);
+                                                      union_desc->bMasterInterface0);
                        ctx->data = usb_ifnum_to_if(dev->udev,
-                                       ctx->union_desc->bSlaveInterface0);
+                                                   union_desc->bSlaveInterface0);
                        break;
 
                case USB_CDC_ETHERNET_TYPE:
@@ -458,7 +458,7 @@ advance:
        }
 
        /* some buggy devices have an IAD but no CDC Union */
-       if (!ctx->union_desc && intf->intf_assoc && intf->intf_assoc->bInterfaceCount == 2) {
+       if (!union_desc && intf->intf_assoc && intf->intf_assoc->bInterfaceCount == 2) {
                ctx->control = intf;
                ctx->data = usb_ifnum_to_if(dev->udev, intf->cur_altsetting->desc.bInterfaceNumber + 1);
                dev_dbg(&intf->dev, "CDC Union missing - got slave from IAD\n");
index 89b52a0fe4b9746883028d8e7b4d6dd3fb3f5edf..cad54ad4ad125e39ff2d0f0a4373f3999ca70db7 100644 (file)
@@ -92,9 +92,7 @@ struct cdc_ncm_ctx {
        struct tasklet_struct bh;
 
        const struct usb_cdc_ncm_desc *func_desc;
-       const struct usb_cdc_mbim_desc   *mbim_desc;
-       const struct usb_cdc_header_desc *header_desc;
-       const struct usb_cdc_union_desc *union_desc;
+       const struct usb_cdc_mbim_desc *mbim_desc;
        const struct usb_cdc_ether_desc *ether_desc;
 
        struct usb_interface *control;