* [PATCH 1/4] usb: dwc3: gadget: free trb pool only from epnum 2
@ 2013-05-27 9:05 George Cherian
2013-05-27 9:30 ` Cherian, George
0 siblings, 1 reply; 2+ messages in thread
From: George Cherian @ 2013-05-27 9:05 UTC (permalink / raw)
To: linux-usb, linux-omap, linux-kernel; +Cc: balbi, gregkh, George Cherian
we never allocate a TRB pool for physical endpoints
0 and 1 so trying to free it (a invalid TRB pool pointer)
will lead us in a warning while removing dwc3.ko module.
In order to fix the situation, all we have to do is skip
dwc3_free_trb_pool() for physical endpoints 0 and 1 just
as we while deleting endpoints from the endpoints list.
Signed-off-by: George Cherian <george.cherian@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/usb/dwc3/gadget.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 2b6e7e0..1c246f9 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1706,12 +1706,20 @@ static void dwc3_gadget_free_endpoints(struct dwc3 *dwc)
dep = dwc->eps[epnum];
if (!dep)
continue;
+ /*
+ * physical endpoints 0 and 1 are special. They form the
+ * bi-directional USB endpoint 0.
+ *
+ * For those two physical endpoints, we don't allocate a TRB
+ * pool nor do we add them the endpoints list. Due to that, we
+ * should these two operations otherwise we would end up with
+ * all sorts of bugs when removing dwc3.ko.
+ */
- dwc3_free_trb_pool(dep);
-
- if (epnum != 0 && epnum != 1)
+ if (epnum != 0 && epnum != 1) {
+ dwc3_free_trb_pool(dep);
list_del(&dep->endpoint.ep_list);
-
+ }
kfree(dep);
}
}
--
1.8.1.4
^ permalink raw reply [flat|nested] 2+ messages in thread
* RE: [PATCH 1/4] usb: dwc3: gadget: free trb pool only from epnum 2
2013-05-27 9:05 [PATCH 1/4] usb: dwc3: gadget: free trb pool only from epnum 2 George Cherian
@ 2013-05-27 9:30 ` Cherian, George
0 siblings, 0 replies; 2+ messages in thread
From: Cherian, George @ 2013-05-27 9:30 UTC (permalink / raw)
To: linux-usb, linux-omap, linux-kernel; +Cc: Balbi, Felipe, gregkh
> -----Original Message-----
> From: Cherian, George
> Sent: Monday, May 27, 2013 2:36 PM
> To: linux-usb@vger.kernel.org; linux-omap@vger.kernel.org; linux-
> kernel@vger.kernel.org
> Cc: Balbi, Felipe; gregkh@linuxfoundation.org; Cherian, George
> Subject: [PATCH 1/4] usb: dwc3: gadget: free trb pool only from epnum 2
Please read [PATCH 1/4] as [PATCH 1/1].
>
> we never allocate a TRB pool for physical endpoints
> 0 and 1 so trying to free it (a invalid TRB pool pointer)
> will lead us in a warning while removing dwc3.ko module.
>
> In order to fix the situation, all we have to do is skip
> dwc3_free_trb_pool() for physical endpoints 0 and 1 just
> as we while deleting endpoints from the endpoints list.
>
> Signed-off-by: George Cherian <george.cherian@ti.com>
> Signed-off-by: Felipe Balbi <balbi@ti.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-05-27 9:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-27 9:05 [PATCH 1/4] usb: dwc3: gadget: free trb pool only from epnum 2 George Cherian
2013-05-27 9:30 ` Cherian, George
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®