mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-04 04:06:26 +00:00
usb: dwc3: gadget: free trb pool only from epnum 2
commit 5bf8fae33d
upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
c67d06ef08
commit
48691720be
@ -1637,10 +1637,20 @@ static void dwc3_gadget_free_endpoints(struct dwc3 *dwc)
|
||||
|
||||
for (epnum = 0; epnum < DWC3_ENDPOINTS_NUM; epnum++) {
|
||||
dep = dwc->eps[epnum];
|
||||
dwc3_free_trb_pool(dep);
|
||||
|
||||
if (epnum != 0 && epnum != 1)
|
||||
/*
|
||||
* 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
|
||||
* shouldn't do these two operations otherwise we would end up
|
||||
* with all sorts of bugs when removing dwc3.ko.
|
||||
*/
|
||||
if (epnum != 0 && epnum != 1) {
|
||||
dwc3_free_trb_pool(dep);
|
||||
list_del(&dep->endpoint.ep_list);
|
||||
}
|
||||
|
||||
kfree(dep);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user