dmaengine: fsl-edma: Fix clk leak on alloc_chan_resources failure
Subsystems (4)
PATCH v4 1/1 dmaengine: fsl-edma: Fix clk leak on alloc_chan_resources failure
When fsl_edma_alloc_chan_resources() fails after clk_prepare_enable(), the error paths only free IRQs and destroy the TCD pool, but forget to call clk_disable_unprepare(). This causes the channel clock to remain enabled, leaking power and resources.
Fix it by disabling the channel clock in the error unwind path.
---
Changes in v2:
- Remove FSL_EDMA_DRV_HAS_CHCLK check
Changes in v3:
- Remove cleanup
Changes in v4:
- Re-send as a new thread
--- drivers/dma/fsl-edma-common.c | 1 + 1 file changed, 1 insertion(+)
drivers/dma/fsl-edma-common.c +1 -0
@@ -852,6 +852,7 @@ int fsl_edma_alloc_chan_resources(struct dma_chan *chan)free_irq (fsl_chan->txirq, fsl_chan); err_txirq:dma_pool_destroy (fsl_chan->tcd_pool); +clk_disable_unprepare (fsl_chan->clk);return ret; }
Signature · 1 line
2.20.1
Quoted 11 lines · Zhen Ni
When
fsl_edma_alloc_chan_resources()fails afterclk_prepare_enable(), the error paths only free IRQs and destroy the TCD pool, but forget to callclk_disable_unprepare(). This causes the channel clock to remain enabled, leaking power and resources.Fix it by disabling the channel clock in the error unwind path.
Fixes d8d4355861d8 ("dmaengine: fsl-edma: add i.MX8ULP edma support")Suggested-by Frank Li <[email protected]>Signed-off-by Zhen Ni <[email protected]>
Quoted 26 lines
---
Changes in v2:
- RemoveFSL_EDMA_DRV_HAS_CHCLKcheck
Changes in v3:
- Remove cleanup
Changes in v4:
- Re-send as a new thread--- drivers/dma/fsl-edma-common.c | 1 + 1 file changed, 1 insertion(+)drivers/dma/fsl-edma-common.c +1
-1@@ -852,6 +852,7 @@ int fsl_edma_alloc_chan_resources(struct dma_chan *chan)free_irq (fsl_chan->txirq, fsl_chan); err_txirq:dma_pool_destroy (fsl_chan->tcd_pool); +clk_disable_unprepare (fsl_chan->clk);return ret; } --2.20.1
Frank Li
maintainerQuoted 6 lines · Frank Li
Quoted 5 lines · Zhen Ni
When
fsl_edma_alloc_chan_resources()fails afterclk_prepare_enable(), the error paths only free IRQs and destroy the TCD pool, but forget to callclk_disable_unprepare(). This causes the channel clock to remain enabled, leaking power and resources.
Quoted 8 lines
Quoted 6 lines
Fix it by disabling the channel clock in the error unwind path.
Fixes d8d4355861d8 ("dmaengine: fsl-edma: add i.MX8ULP edma support")Suggested-by Frank Li <[email protected]>Signed-off-by Zhen Ni <[email protected]>Reviewed-by Frank Li <[email protected]>
Vinod Koul:
Do you have chance to pickup this small fix patch?
Frank
Quoted 27 lines
Quoted 27 lines
---
Changes in v2:
- RemoveFSL_EDMA_DRV_HAS_CHCLKcheck
Changes in v3:
- Remove cleanup
Changes in v4:
- Re-send as a new thread--- drivers/dma/fsl-edma-common.c | 1 + 1 file changed, 1 insertion(+)drivers/dma/fsl-edma-common.c +1
-1@@ -852,6 +852,7 @@ int fsl_edma_alloc_chan_resources(struct dma_chan *chan)free_irq (fsl_chan->txirq, fsl_chan); err_txirq:dma_pool_destroy (fsl_chan->tcd_pool); +clk_disable_unprepare (fsl_chan->clk);return ret; } --2.20.1
Quoted 8 lines · Zhen Ni
When
fsl_edma_alloc_chan_resources()fails afterclk_prepare_enable(), the error paths only free IRQs and destroy the TCD pool, but forget to callclk_disable_unprepare(). This causes the channel clock to remain enabled, leaking power and resources.Fix it by disabling the channel clock in the error unwind path.
[...]
Applied, thanks!
[1/1] dmaengine: fsl-edma: Fix clk leak on alloc_chan_resources failure
commit: b18cd8b210417f90537d914ffb96e390c85a7379
Best regards,
Signature · 1 line
~Vinod