* [PATCH] dmaengine: stm32-mdma: Fix runtime PM reference leak in pm_suspend
@ 2026-11-02 10:44 Xiangwu Lai
2026-11-02 12:23 ` Amelie Delaunay
0 siblings, 1 reply; 2+ messages in thread
From: Xiangwu Lai @ 2026-11-02 10:44 UTC (permalink / raw)
To: Amélie Delaunay, Vinod Koul, Maxime Coquelin, Alexandre Torgue
Cc: Frank Li, dmaengine, linux-stm32, linux-arm-kernel, linux-kernel,
Xiangwu Lai
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@cmss.chinamobile.com>
---
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;
}
}
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] dmaengine: stm32-mdma: Fix runtime PM reference leak in pm_suspend
2026-11-02 10:44 [PATCH] dmaengine: stm32-mdma: Fix runtime PM reference leak in pm_suspend Xiangwu Lai
@ 2026-11-02 12:23 ` Amelie Delaunay
0 siblings, 0 replies; 2+ messages in thread
From: Amelie Delaunay @ 2026-11-02 12:23 UTC (permalink / raw)
To: Xiangwu Lai, Vinod Koul, Maxime Coquelin, Alexandre Torgue
Cc: Frank Li, dmaengine, linux-stm32, linux-arm-kernel, linux-kernel
On 11/2/26 11:44, Xiangwu Lai wrote:
> 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@cmss.chinamobile.com>
Thanks for your patch,
Reviewed-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
> ---
> 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;
> }
> }
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-02 12:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-02 10:44 [PATCH] dmaengine: stm32-mdma: Fix runtime PM reference leak in pm_suspend Xiangwu Lai
2026-11-02 12:23 ` Amelie Delaunay
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®