From 95f0d8bddcbf09309dc5236e71e2412cd283c2fa Mon Sep 17 00:00:00 2001 From: Benoit Goby Date: Wed, 19 Sep 2012 17:03:34 -0700 Subject: [PATCH] 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 --- drivers/usb/gadget/f_fs.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c index f394f295d63d..3d132cb786f0 100644 --- a/drivers/usb/gadget/f_fs.c +++ b/drivers/usb/gadget/f_fs.c @@ -1569,7 +1569,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; -- 2.34.1