From: Peter Chen Date: Mon, 9 Sep 2019 06:37:34 +0000 (+0800) Subject: MLK-22527-1 usb: cdns3: gadget: quit functional halt if there are pending requests X-Git-Tag: rel_imx_4.19.35_1.1.0~61 X-Git-Url: https://git.somdevices.com/?a=commitdiff_plain;h=bca66d3f0887d320d1e970dac7f825a58e5801b2;p=linux.git MLK-22527-1 usb: cdns3: gadget: quit functional halt if there are pending requests If the non-control endpoints want to halt, but there are pending requests on this endpoint, we need to return -EAGAIN, otherwise, the controller may be in stuck if we stall the doolbell'ed endpoint. With this change, we could pass the USB certification MSC test. Reviewed-by: Jun Li Signed-off-by: Peter Chen --- diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c index b76b8e1757fd..3a5bed0b2bad 100644 --- a/drivers/usb/cdns3/gadget.c +++ b/drivers/usb/cdns3/gadget.c @@ -1836,6 +1836,11 @@ int cdns3_gadget_ep_set_halt(struct usb_ep *ep, int value) cdns3_select_ep(priv_dev, ep->desc->bEndpointAddress); if (value) { + if (!list_empty(&priv_ep->pending_req_list)) { + ret = -EAGAIN; + goto finish; + } + cdns3_ep_stall_flush(priv_ep); } else { priv_ep->flags &= ~EP_WEDGE;