mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [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
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ 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] 5+ 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
  2026-11-02 21:13 ` Frank Li
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ 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] 5+ 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
@ 2026-11-02 21:13 ` Frank Li
  2026-11-20  7:34 ` [PATCH] dmaengine: stm32-mdma: Fix runtime PM reference leak in pm_suspend() Xiangwu Lai
  2026-11-20 10:04 ` [PATCH] dmaengine: stm32-mdma: Fix runtime PM reference leak in pm_suspend Vinod Koul
  3 siblings, 0 replies; 5+ messages in thread
From: Frank Li @ 2026-11-02 21:13 UTC (permalink / raw)
  To: Xiangwu Lai
  Cc: Amélie Delaunay, Vinod Koul, Maxime Coquelin,
	Alexandre Torgue, Frank Li, dmaengine, linux-stm32,
	linux-arm-kernel, linux-kernel

On Mon, Nov 02, 2026 at 06:44:31PM +0800, Xiangwu Lai wrote:
> [You don't often get email from laixiangwu@cmss.chinamobile.com. 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@cmss.chinamobile.com>

Reviewed-by: Frank Li <Frank.Li@nxp.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] 5+ 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
  2026-11-02 21:13 ` Frank Li
@ 2026-11-20  7:34 ` Xiangwu Lai
  2026-11-20 10:04 ` [PATCH] dmaengine: stm32-mdma: Fix runtime PM reference leak in pm_suspend Vinod Koul
  3 siblings, 0 replies; 5+ messages in thread
From: Xiangwu Lai @ 2026-11-20  7:34 UTC (permalink / raw)
  To: vkoul
  Cc: Xiangwu Lai, amelie.delaunay, Frank.Li, mcoquelin.stm32,
	alexandre.torgue, dmaengine, linux-stm32, linux-arm-kernel,
	linux-kernel

Hi Vinod,

gentle ping on this patch:

  [PATCH] dmaengine: stm32-mdma: Fix runtime PM reference leak in pm_suspend()
  https://lore.kernel.org/r/20261102104432.873-1-laixiangwu@cmss.chinamobile.com

stm32_mdma_pm_suspend() takes a runtime PM reference with
pm_runtime_resume_and_get() and returns -EBUSY without dropping it when
a channel is still enabled, so each aborted suspend leaks one
reference.  The patch adds the missing pm_runtime_put_sync() on the
-EBUSY path.

The patch carries both Reviewed-by tags since early November:

  Reviewed-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
  Reviewed-by: Frank Li <Frank.Li@kernel.org>

The sibling fix for stm32-dma is pending on the same topic as well
(Reviewed-by: Amelie Delaunay and Frank Li):

  [PATCH] dmaengine: stm32-dma: Fix runtime PM reference leak in pm_suspend()
  https://lore.kernel.org/r/20261102104108.794-1-laixiangwu@cmss.chinamobile.com

Could these two be queued for the next merge window?

Thanks,
Xiangwu Lai



^ permalink raw reply	[flat|nested] 5+ 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
                   ` (2 preceding siblings ...)
  2026-11-20  7:34 ` [PATCH] dmaengine: stm32-mdma: Fix runtime PM reference leak in pm_suspend() Xiangwu Lai
@ 2026-11-20 10:04 ` Vinod Koul
  3 siblings, 0 replies; 5+ messages in thread
From: Vinod Koul @ 2026-11-20 10:04 UTC (permalink / raw)
  To: Amélie Delaunay, Maxime Coquelin, Alexandre Torgue, Xiangwu Lai
  Cc: Frank Li, dmaengine, linux-stm32, linux-arm-kernel, linux-kernel


On Mon, 02 Nov 2026 18:44:31 +0800, 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.
> 
> [...]

Applied, thanks!

[1/1] dmaengine: stm32-mdma: Fix runtime PM reference leak in pm_suspend
      commit: 34c8c2ea213aab7b452df93e5b7547f4459a49e9

Best regards,
-- 
~Vinod



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-20 10:04 UTC | newest]

Thread overview: 5+ 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
2026-11-02 21:13 ` Frank Li
2026-11-20  7:34 ` [PATCH] dmaengine: stm32-mdma: Fix runtime PM reference leak in pm_suspend() Xiangwu Lai
2026-11-20 10:04 ` [PATCH] dmaengine: stm32-mdma: Fix runtime PM reference leak in pm_suspend Vinod Koul

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®