]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/usb/gadget/composite.c
USB: composite: Fix bug: low byte of w_index is the usb interface number not the...
[linux-2.6-omap-h63xx.git] / drivers / usb / gadget / composite.c
index 363951eb333ca331c455fc876f0f918e1667d150..5d11c291f1ad113da485076efb4ec9724f253178 100644 (file)
@@ -683,6 +683,7 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
        struct usb_request              *req = cdev->req;
        int                             value = -EOPNOTSUPP;
        u16                             w_index = le16_to_cpu(ctrl->wIndex);
+       u8                              intf = w_index & 0xFF;
        u16                             w_value = le16_to_cpu(ctrl->wValue);
        u16                             w_length = le16_to_cpu(ctrl->wLength);
        struct usb_function             *f = NULL;
@@ -769,7 +770,7 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
                        goto unknown;
                if (!cdev->config || w_index >= MAX_CONFIG_INTERFACES)
                        break;
-               f = cdev->config->interface[w_index];
+               f = cdev->config->interface[intf];
                if (!f)
                        break;
                if (w_value && !f->set_alt)
@@ -781,7 +782,7 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
                        goto unknown;
                if (!cdev->config || w_index >= MAX_CONFIG_INTERFACES)
                        break;
-               f = cdev->config->interface[w_index];
+               f = cdev->config->interface[intf];
                if (!f)
                        break;
                /* lots of interfaces only need altsetting zero... */
@@ -808,7 +809,7 @@ unknown:
                 */
                if ((ctrl->bRequestType & USB_RECIP_MASK)
                                == USB_RECIP_INTERFACE) {
-                       f = cdev->config->interface[w_index];
+                       f = cdev->config->interface[intf];
                        if (f && f->setup)
                                value = f->setup(f, ctrl);
                        else