[PATCH] dmaengine: stm32-dma: Fix runtime PM reference leak in pm_suspend

Frank Li Frank.li at oss.nxp.com
Fri Nov 13 11:41:22 PST 2026


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 at cmss.chinamobile.com>
> ---

Reviewed-by: Frank Li <Frank.Li at nxp.com>

>  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;
>  		}
>  	}
>
>



More information about the linux-arm-kernel mailing list