imx.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] dmaengine: fsl-edma: Fix clk leak on alloc_chan_resources failure
@ 2025-10-10  9:02 Zhen Ni
  2025-10-10 14:10 ` Frank Li
  2025-10-11  3:06 ` [PATCH v2] " Zhen Ni
  0 siblings, 2 replies; 5+ messages in thread
From: Zhen Ni @ 2025-10-10  9:02 UTC (permalink / raw)
  To: Frank.Li, vkoul; +Cc: imx, dmaengine, Zhen Ni, stable

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.

Fixes: d8d4355861d8 ("dmaengine: fsl-edma: add i.MX8ULP edma support")
Cc: stable@vger.kernel.org
Signed-off-by: Zhen Ni <zhen.ni@easystack.cn>
---
 drivers/dma/fsl-edma-common.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c
index 4976d7dde080..bd673f08f610 100644
--- a/drivers/dma/fsl-edma-common.c
+++ b/drivers/dma/fsl-edma-common.c
@@ -852,6 +852,8 @@ 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);
+	if (fsl_edma_drvflags(fsl_chan) & FSL_EDMA_DRV_HAS_CHCLK)
+		clk_disable_unprepare(fsl_chan->clk);
 
 	return ret;
 }
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-10-14  2:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-10  9:02 [PATCH] dmaengine: fsl-edma: Fix clk leak on alloc_chan_resources failure Zhen Ni
2025-10-10 14:10 ` Frank Li
2025-10-11  3:06 ` [PATCH v2] " Zhen Ni
2025-10-13 19:48   ` Frank Li
2025-10-14  2:37   ` [PATCH v3] " Zhen Ni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).