diff options
Diffstat (limited to 'drivers/usb/dwc3/gadget.c')
-rw-r--r-- | drivers/usb/dwc3/gadget.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 2b6e7e001207..b5e5b35df49c 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
@@ -1706,11 +1706,19 @@ static void dwc3_gadget_free_endpoints(struct dwc3 *dwc) | |||
1706 | dep = dwc->eps[epnum]; | 1706 | dep = dwc->eps[epnum]; |
1707 | if (!dep) | 1707 | if (!dep) |
1708 | continue; | 1708 | continue; |
1709 | 1709 | /* | |
1710 | dwc3_free_trb_pool(dep); | 1710 | * Physical endpoints 0 and 1 are special; they form the |
1711 | 1711 | * bi-directional USB endpoint 0. | |
1712 | if (epnum != 0 && epnum != 1) | 1712 | * |
1713 | * For those two physical endpoints, we don't allocate a TRB | ||
1714 | * pool nor do we add them the endpoints list. Due to that, we | ||
1715 | * shouldn't do these two operations otherwise we would end up | ||
1716 | * with all sorts of bugs when removing dwc3.ko. | ||
1717 | */ | ||
1718 | if (epnum != 0 && epnum != 1) { | ||
1719 | dwc3_free_trb_pool(dep); | ||
1713 | list_del(&dep->endpoint.ep_list); | 1720 | list_del(&dep->endpoint.ep_list); |
1721 | } | ||
1714 | 1722 | ||
1715 | kfree(dep); | 1723 | kfree(dep); |
1716 | } | 1724 | } |