Re: [PATCH] dmaengine: stm32-dma: Fix runtime PM reference leak in pm_suspend
From: Frank Li
Date: Fri Nov 13 2026 - 15:02:05 EST
On Mon, Nov 02, 2026 at 06:41:07PM +0800, Xiangwu Lai wrote:
> stm32_dma_pm_suspend() increments the runtime PM usage counter with
> pm_runtime_resume_and_get(), but when a channel is still enabled it
> returns -EBUSY directly without dropping the reference. The matching
> pm_runtime_put_sync() only runs on the success path.
>
> Each failed suspend attempt therefore leaks one runtime PM reference,
> so the device can never runtime suspend afterwards. Drop the
> reference before returning -EBUSY.
>
> Fixes: 05f8740a0e6f ("dmaengine: stm32-dma: add suspend/resume power management support")
> Signed-off-by: Xiangwu Lai <laixiangwu@xxxxxxxxxxxxxxxxxxxx>
> ---
Reviewed-by: Frank Li <Frank.Li@xxxxxxx>
> drivers/dma/stm32/stm32-dma.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/dma/stm32/stm32-dma.c b/drivers/dma/stm32/stm32-dma.c
> index d3ad78562..2abe846a9 100644
> --- a/drivers/dma/stm32/stm32-dma.c
> +++ b/drivers/dma/stm32/stm32-dma.c
> @@ -1743,6 +1743,7 @@ static int stm32_dma_pm_suspend(struct device *dev)
> scr = stm32_dma_read(dmadev, STM32_DMA_SCR(id));
> if (scr & STM32_DMA_SCR_EN) {
> dev_warn(dev, "Suspend is prevented by Chan %i\n", id);
> + pm_runtime_put_sync(dev);
> return -EBUSY;
> }
> }
>
>