From: Benoit Goby Date: Thu, 20 Sep 2012 00:03:34 +0000 (-0700) Subject: usb: gadget: f_fs: Fix enumeration in fullspeed mode X-Git-Tag: firefly_0821_release~4090^2~672 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=95f0d8bddcbf09309dc5236e71e2412cd283c2fa;p=firefly-linux-kernel-4.4.55.git 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 --- 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;