summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@quicinc.com>2017-07-11 00:40:22 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2017-07-11 00:40:22 -0700
commite5a68ffaa375a3503ac31de90a8a2c09d5526740 (patch)
tree338be0f46e39dddfdbe0c5d81a40e4d1815d600e /drivers/usb
parent0f0e37eeace714d4b3bb6907323d46ba2c6d73f1 (diff)
parent9aabfa05967291ecbc7a0bfcca27c9669dd1853e (diff)
Merge "Merge android-4.4@8c91412 (v4.4.75) into msm-4.4"
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/usbip/vhci_hcd.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c
index 7fbe19d5279e..81b2b9f808b5 100644
--- a/drivers/usb/usbip/vhci_hcd.c
+++ b/drivers/usb/usbip/vhci_hcd.c
@@ -215,14 +215,19 @@ done:
static inline void hub_descriptor(struct usb_hub_descriptor *desc)
{
+ int width;
+
memset(desc, 0, sizeof(*desc));
desc->bDescriptorType = USB_DT_HUB;
- desc->bDescLength = 9;
desc->wHubCharacteristics = cpu_to_le16(
HUB_CHAR_INDV_PORT_LPSM | HUB_CHAR_COMMON_OCPM);
+
desc->bNbrPorts = VHCI_NPORTS;
- desc->u.hs.DeviceRemovable[0] = 0xff;
- desc->u.hs.DeviceRemovable[1] = 0xff;
+ BUILD_BUG_ON(VHCI_NPORTS > USB_MAXCHILDREN);
+ width = desc->bNbrPorts / 8 + 1;
+ desc->bDescLength = USB_DT_HUB_NONVAR_SIZE + 2 * width;
+ memset(&desc->u.hs.DeviceRemovable[0], 0, width);
+ memset(&desc->u.hs.DeviceRemovable[width], 0xff, width);
}
static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,