aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/composite.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/gadget/composite.c')
-rw-r--r--drivers/usb/gadget/composite.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 1160c55de7f2..67746b19ac54 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -901,7 +901,8 @@ unknown:
901 */ 901 */
902 switch (ctrl->bRequestType & USB_RECIP_MASK) { 902 switch (ctrl->bRequestType & USB_RECIP_MASK) {
903 case USB_RECIP_INTERFACE: 903 case USB_RECIP_INTERFACE:
904 f = cdev->config->interface[intf]; 904 if (cdev->config)
905 f = cdev->config->interface[intf];
905 break; 906 break;
906 907
907 case USB_RECIP_ENDPOINT: 908 case USB_RECIP_ENDPOINT:
@@ -1082,14 +1083,6 @@ static int composite_bind(struct usb_gadget *gadget)
1082 */ 1083 */
1083 usb_ep_autoconfig_reset(cdev->gadget); 1084 usb_ep_autoconfig_reset(cdev->gadget);
1084 1085
1085 /* standardized runtime overrides for device ID data */
1086 if (idVendor)
1087 cdev->desc.idVendor = cpu_to_le16(idVendor);
1088 if (idProduct)
1089 cdev->desc.idProduct = cpu_to_le16(idProduct);
1090 if (bcdDevice)
1091 cdev->desc.bcdDevice = cpu_to_le16(bcdDevice);
1092
1093 /* composite gadget needs to assign strings for whole device (like 1086 /* composite gadget needs to assign strings for whole device (like
1094 * serial number), register function drivers, potentially update 1087 * serial number), register function drivers, potentially update
1095 * power state and consumption, etc 1088 * power state and consumption, etc
@@ -1101,6 +1094,14 @@ static int composite_bind(struct usb_gadget *gadget)
1101 cdev->desc = *composite->dev; 1094 cdev->desc = *composite->dev;
1102 cdev->desc.bMaxPacketSize0 = gadget->ep0->maxpacket; 1095 cdev->desc.bMaxPacketSize0 = gadget->ep0->maxpacket;
1103 1096
1097 /* standardized runtime overrides for device ID data */
1098 if (idVendor)
1099 cdev->desc.idVendor = cpu_to_le16(idVendor);
1100 if (idProduct)
1101 cdev->desc.idProduct = cpu_to_le16(idProduct);
1102 if (bcdDevice)
1103 cdev->desc.bcdDevice = cpu_to_le16(bcdDevice);
1104
1104 /* strings can't be assigned before bind() allocates the 1105 /* strings can't be assigned before bind() allocates the
1105 * releavnt identifiers 1106 * releavnt identifiers
1106 */ 1107 */