]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
dmaengine: fsl-edma: Fix clk leak on alloc_chan_resources failure
authorZhen Ni <zhen.ni@easystack.cn>
Tue, 14 Oct 2025 09:05:22 +0000 (17:05 +0800)
committerVinod Koul <vkoul@kernel.org>
Tue, 16 Dec 2025 15:12:35 +0000 (20:42 +0530)
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>
Link: https://patch.msgid.link/20251014090522.827726-1-zhen.ni@easystack.cn
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/fsl-edma-common.c

index a592127580299681304b222d8cb383535dbcc10f..7137f51ff6a0aa56aa92b2ca56c3665ec6ecb7de 100644 (file)
@@ -873,6 +873,7 @@ err_errirq:
                free_irq(fsl_chan->txirq, fsl_chan);
 err_txirq:
        dma_pool_destroy(fsl_chan->tcd_pool);
+       clk_disable_unprepare(fsl_chan->clk);
 
        return ret;
 }