usb: dwc3: gadget: ignore endpoint IRQs when endpoint is disabled
authorFelipe Balbi <balbi@ti.com>
Wed, 6 Jun 2012 06:19:35 +0000 (09:19 +0300)
committerFelipe Balbi <balbi@ti.com>
Wed, 6 Jun 2012 08:22:32 +0000 (11:22 +0300)
By the time we're disabling the endpoint, HW
could already have posted more events to our
event buffer. In that case, we will receive
endpoint events for a disabled endpoint.

In order to protect ourselves from that situation,
we simply ignore endpoint interrupts whenever
the endpoint is disabled.

Tested-by: Pratyush Anand <pratyush.anand@st.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/dwc3/gadget.c

index 52d0f67e33d56a0218b054822d0639a04df76ec2..8e00756ee522a87c532b3b136d125dd714c0854b 100644 (file)
@@ -1768,6 +1768,9 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc,
 
        dep = dwc->eps[epnum];
 
+       if (!(dep->flags & DWC3_EP_ENABLED))
+               return;
+
        dev_vdbg(dwc->dev, "%s: %s\n", dep->name,
                        dwc3_ep_event_string(event->endpoint_event));