* [PATCH v4] dmaengine: fsl-edma: Fix clk leak on alloc_chan_resources failure
@ 2025-10-14 9:05 Zhen Ni
2025-10-14 15:36 ` Frank Li
2025-12-16 16:56 ` Vinod Koul
0 siblings, 2 replies; 4+ messages in thread
From: Zhen Ni @ 2025-10-14 9:05 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
Suggested-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Zhen Ni <zhen.ni@easystack.cn>
---
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(+)
diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c
index 4976d7dde080..11655dcc4d6c 100644
--- a/drivers/dma/fsl-edma-common.c
+++ b/drivers/dma/fsl-edma-common.c
@@ -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
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH v4] dmaengine: fsl-edma: Fix clk leak on alloc_chan_resources failure
2025-10-14 9:05 [PATCH v4] dmaengine: fsl-edma: Fix clk leak on alloc_chan_resources failure Zhen Ni
@ 2025-10-14 15:36 ` Frank Li
2025-12-03 22:14 ` Frank Li
2025-12-16 16:56 ` Vinod Koul
1 sibling, 1 reply; 4+ messages in thread
From: Frank Li @ 2025-10-14 15:36 UTC (permalink / raw)
To: Zhen Ni; +Cc: vkoul, imx, dmaengine, stable
On Tue, Oct 14, 2025 at 05:05:22PM +0800, Zhen Ni wrote:
> 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
> Suggested-by: Frank Li <Frank.Li@nxp.com>
> Signed-off-by: Zhen Ni <zhen.ni@easystack.cn>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> ---
> 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(+)
>
> diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c
> index 4976d7dde080..11655dcc4d6c 100644
> --- a/drivers/dma/fsl-edma-common.c
> +++ b/drivers/dma/fsl-edma-common.c
> @@ -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
>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH v4] dmaengine: fsl-edma: Fix clk leak on alloc_chan_resources failure
2025-10-14 15:36 ` Frank Li
@ 2025-12-03 22:14 ` Frank Li
0 siblings, 0 replies; 4+ messages in thread
From: Frank Li @ 2025-12-03 22:14 UTC (permalink / raw)
To: Zhen Ni; +Cc: vkoul, imx, dmaengine, stable
On Tue, Oct 14, 2025 at 11:36:29AM -0400, Frank Li wrote:
> On Tue, Oct 14, 2025 at 05:05:22PM +0800, Zhen Ni wrote:
> > 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
> > Suggested-by: Frank Li <Frank.Li@nxp.com>
> > Signed-off-by: Zhen Ni <zhen.ni@easystack.cn>
>
> Reviewed-by: Frank Li <Frank.Li@nxp.com>
Vinod Koul:
Do you have chance to pickup this small fix patch?
Frank
>
> > ---
> > 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(+)
> >
> > diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c
> > index 4976d7dde080..11655dcc4d6c 100644
> > --- a/drivers/dma/fsl-edma-common.c
> > +++ b/drivers/dma/fsl-edma-common.c
> > @@ -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
> >
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v4] dmaengine: fsl-edma: Fix clk leak on alloc_chan_resources failure
2025-10-14 9:05 [PATCH v4] dmaengine: fsl-edma: Fix clk leak on alloc_chan_resources failure Zhen Ni
2025-10-14 15:36 ` Frank Li
@ 2025-12-16 16:56 ` Vinod Koul
1 sibling, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2025-12-16 16:56 UTC (permalink / raw)
To: Frank.Li, Zhen Ni; +Cc: imx, dmaengine, stable
On Tue, 14 Oct 2025 17:05:22 +0800, Zhen Ni wrote:
> 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.
>
> [...]
Applied, thanks!
[1/1] dmaengine: fsl-edma: Fix clk leak on alloc_chan_resources failure
commit: b18cd8b210417f90537d914ffb96e390c85a7379
Best regards,
--
~Vinod
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-12-16 16:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-14 9:05 [PATCH v4] dmaengine: fsl-edma: Fix clk leak on alloc_chan_resources failure Zhen Ni
2025-10-14 15:36 ` Frank Li
2025-12-03 22:14 ` Frank Li
2025-12-16 16:56 ` Vinod Koul
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).