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

From: Frank Li

Date: Mon Nov 02 2026 - 16:14:02 EST


On Mon, Nov 02, 2026 at 06:44:31PM +0800, Xiangwu Lai wrote:
> [You don't often get email from laixiangwu@xxxxxxxxxxxxxxxxxxxx. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> stm32_mdma_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: 7cb819c856d9 ("dmaengine: stm32-mdma: add suspend/resume power management support")
> Signed-off-by: Xiangwu Lai <laixiangwu@xxxxxxxxxxxxxxxxxxxx>

Reviewed-by: Frank Li <Frank.Li@xxxxxxx>

> ---
> drivers/dma/stm32/stm32-mdma.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/dma/stm32/stm32-mdma.c b/drivers/dma/stm32/stm32-mdma.c
> index e3bbdc9ee..fe1ff4a00 100644
> --- a/drivers/dma/stm32/stm32-mdma.c
> +++ b/drivers/dma/stm32/stm32-mdma.c
> @@ -1785,6 +1785,7 @@ static int stm32_mdma_pm_suspend(struct device *dev)
> ccr = stm32_mdma_read(dmadev, STM32_MDMA_CCR(id));
> if (ccr & STM32_MDMA_CCR_EN) {
> dev_warn(dev, "Suspend is prevented by Chan %i\n", id);
> + pm_runtime_put_sync(dev);
> return -EBUSY;
> }
> }
>
>
>