MLK-22527-1 usb: cdns3: gadget: quit functional halt if there are pending requests
authorPeter Chen <peter.chen@nxp.com>
Mon, 9 Sep 2019 06:37:34 +0000 (14:37 +0800)
committerPeter Chen <peter.chen@nxp.com>
Tue, 10 Sep 2019 08:58:48 +0000 (16:58 +0800)
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 <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
drivers/usb/cdns3/gadget.c

index b76b8e1..3a5bed0 100644 (file)
@@ -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;