From bca66d3f0887d320d1e970dac7f825a58e5801b2 Mon Sep 17 00:00:00 2001 From: Peter Chen Date: Mon, 9 Sep 2019 14:37:34 +0800 Subject: [PATCH] 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 --- drivers/usb/cdns3/gadget.c | 5 +++++ 1 file changed, 5 insertions(+) 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; -- 2.17.1