summaryrefslogtreecommitdiff
path: root/drivers/usb/gadget
diff options
context:
space:
mode:
authorBenoit Goby <benoit@android.com>2012-09-19 17:03:34 -0700
committerColin Cross <ccross@android.com>2014-03-19 13:09:26 -0700
commite7cf5e54f886d52cadadc7b2109cee0e10023c3b (patch)
treeeba04aca142b3d67b566c74aaa55705c89a53a2b /drivers/usb/gadget
parent3df9729f3fe3d9ce5a8ea16d8396520a7ef2c0e1 (diff)
usb: gadget: f_fs: Fix enumeration in fullspeed mode
ffs_func_eps_enable always take the highspeed usb_endpoint_descriptor if it is available. Choose the correct usb_endpoint_descriptor depending on the gadget speed instead. Change-Id: I5b8444cfdf1b6fe1eef25525fb7a0a0f617a353e Signed-off-by: Benoit Goby <benoit@android.com>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r--drivers/usb/gadget/f_fs.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
index 2b4334394076..663078c0dafe 100644
--- a/drivers/usb/gadget/f_fs.c
+++ b/drivers/usb/gadget/f_fs.c
@@ -1334,7 +1334,12 @@ static int ffs_func_eps_enable(struct ffs_function *func)
spin_lock_irqsave(&func->ffs->eps_lock, flags);
do {
struct usb_endpoint_descriptor *ds;
- ds = ep->descs[ep->descs[1] ? 1 : 0];
+ int desc_idx = ffs->gadget->speed == USB_SPEED_HIGH ? 1 : 0;
+ ds = ep->descs[desc_idx];
+ if (!ds) {
+ ret = -EINVAL;
+ break;
+ }
ep->ep->driver_data = ep;
ep->ep->desc = ds;