diff options
Diffstat (limited to 'drivers/usb/gadget/composite.c')
-rw-r--r-- | drivers/usb/gadget/composite.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index f2da0269e1b1..5d11c291f1ad 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c | |||
@@ -683,6 +683,7 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) | |||
683 | struct usb_request *req = cdev->req; | 683 | struct usb_request *req = cdev->req; |
684 | int value = -EOPNOTSUPP; | 684 | int value = -EOPNOTSUPP; |
685 | u16 w_index = le16_to_cpu(ctrl->wIndex); | 685 | u16 w_index = le16_to_cpu(ctrl->wIndex); |
686 | u8 intf = w_index & 0xFF; | ||
686 | u16 w_value = le16_to_cpu(ctrl->wValue); | 687 | u16 w_value = le16_to_cpu(ctrl->wValue); |
687 | u16 w_length = le16_to_cpu(ctrl->wLength); | 688 | u16 w_length = le16_to_cpu(ctrl->wLength); |
688 | struct usb_function *f = NULL; | 689 | struct usb_function *f = NULL; |
@@ -769,10 +770,10 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) | |||
769 | goto unknown; | 770 | goto unknown; |
770 | if (!cdev->config || w_index >= MAX_CONFIG_INTERFACES) | 771 | if (!cdev->config || w_index >= MAX_CONFIG_INTERFACES) |
771 | break; | 772 | break; |
772 | f = cdev->config->interface[w_index]; | 773 | f = cdev->config->interface[intf]; |
773 | if (!f) | 774 | if (!f) |
774 | break; | 775 | break; |
775 | if (w_value && !f->get_alt) | 776 | if (w_value && !f->set_alt) |
776 | break; | 777 | break; |
777 | value = f->set_alt(f, w_index, w_value); | 778 | value = f->set_alt(f, w_index, w_value); |
778 | break; | 779 | break; |
@@ -781,7 +782,7 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) | |||
781 | goto unknown; | 782 | goto unknown; |
782 | if (!cdev->config || w_index >= MAX_CONFIG_INTERFACES) | 783 | if (!cdev->config || w_index >= MAX_CONFIG_INTERFACES) |
783 | break; | 784 | break; |
784 | f = cdev->config->interface[w_index]; | 785 | f = cdev->config->interface[intf]; |
785 | if (!f) | 786 | if (!f) |
786 | break; | 787 | break; |
787 | /* lots of interfaces only need altsetting zero... */ | 788 | /* lots of interfaces only need altsetting zero... */ |
@@ -808,7 +809,7 @@ unknown: | |||
808 | */ | 809 | */ |
809 | if ((ctrl->bRequestType & USB_RECIP_MASK) | 810 | if ((ctrl->bRequestType & USB_RECIP_MASK) |
810 | == USB_RECIP_INTERFACE) { | 811 | == USB_RECIP_INTERFACE) { |
811 | f = cdev->config->interface[w_index]; | 812 | f = cdev->config->interface[intf]; |
812 | if (f && f->setup) | 813 | if (f && f->setup) |
813 | value = f->setup(f, ctrl); | 814 | value = f->setup(f, ctrl); |
814 | else | 815 | else |