diff options
author | Vardan Mikayelyan <mvardan@synopsys.com> | 2017-01-05 21:01:48 -0500 |
---|---|---|
committer | Felipe Balbi <felipe.balbi@linux.intel.com> | 2017-01-12 02:58:52 -0500 |
commit | 9383e084a88d04d442ea2dce128edff05f344e5c (patch) | |
tree | f10b756c783249a59fb6441566f1a2f5643d3903 /drivers/usb | |
parent | 990758c53eafe5a220a780ed12e7b4d51b3df032 (diff) |
usb: dwc2: gadget: Fix DMA memory freeing
Remove DMA memory free from EP disable flow by replacing
dma_alloc_coherent with dmam_alloc_coherent.
Tested-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Vardan Mikayelyan <mvardan@synopsys.com>
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/dwc2/gadget.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index c55db4aa54d6..2a9e51c176cc 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c | |||
@@ -3749,8 +3749,8 @@ static int dwc2_hsotg_ep_enable(struct usb_ep *ep, | |||
3749 | __func__, epctrl, epctrl_reg); | 3749 | __func__, epctrl, epctrl_reg); |
3750 | 3750 | ||
3751 | /* Allocate DMA descriptor chain for non-ctrl endpoints */ | 3751 | /* Allocate DMA descriptor chain for non-ctrl endpoints */ |
3752 | if (using_desc_dma(hsotg)) { | 3752 | if (using_desc_dma(hsotg) && !hs_ep->desc_list) { |
3753 | hs_ep->desc_list = dma_alloc_coherent(hsotg->dev, | 3753 | hs_ep->desc_list = dmam_alloc_coherent(hsotg->dev, |
3754 | MAX_DMA_DESC_NUM_GENERIC * | 3754 | MAX_DMA_DESC_NUM_GENERIC * |
3755 | sizeof(struct dwc2_dma_desc), | 3755 | sizeof(struct dwc2_dma_desc), |
3756 | &hs_ep->desc_list_dma, GFP_ATOMIC); | 3756 | &hs_ep->desc_list_dma, GFP_ATOMIC); |
@@ -3872,7 +3872,7 @@ error1: | |||
3872 | 3872 | ||
3873 | error2: | 3873 | error2: |
3874 | if (ret && using_desc_dma(hsotg) && hs_ep->desc_list) { | 3874 | if (ret && using_desc_dma(hsotg) && hs_ep->desc_list) { |
3875 | dma_free_coherent(hsotg->dev, MAX_DMA_DESC_NUM_GENERIC * | 3875 | dmam_free_coherent(hsotg->dev, MAX_DMA_DESC_NUM_GENERIC * |
3876 | sizeof(struct dwc2_dma_desc), | 3876 | sizeof(struct dwc2_dma_desc), |
3877 | hs_ep->desc_list, hs_ep->desc_list_dma); | 3877 | hs_ep->desc_list, hs_ep->desc_list_dma); |
3878 | hs_ep->desc_list = NULL; | 3878 | hs_ep->desc_list = NULL; |
@@ -3902,14 +3902,6 @@ static int dwc2_hsotg_ep_disable(struct usb_ep *ep) | |||
3902 | return -EINVAL; | 3902 | return -EINVAL; |
3903 | } | 3903 | } |
3904 | 3904 | ||
3905 | /* Remove DMA memory allocated for non-control Endpoints */ | ||
3906 | if (using_desc_dma(hsotg)) { | ||
3907 | dma_free_coherent(hsotg->dev, MAX_DMA_DESC_NUM_GENERIC * | ||
3908 | sizeof(struct dwc2_dma_desc), | ||
3909 | hs_ep->desc_list, hs_ep->desc_list_dma); | ||
3910 | hs_ep->desc_list = NULL; | ||
3911 | } | ||
3912 | |||
3913 | epctrl_reg = dir_in ? DIEPCTL(index) : DOEPCTL(index); | 3905 | epctrl_reg = dir_in ? DIEPCTL(index) : DOEPCTL(index); |
3914 | 3906 | ||
3915 | spin_lock_irqsave(&hsotg->lock, flags); | 3907 | spin_lock_irqsave(&hsotg->lock, flags); |