dmaengine: stm32-mdma: Fix runtime PM reference leak in pm_suspend
Subsystems (3)
PATCH 1/1 dmaengine: stm32-mdma: Fix runtime PM reference leak in pm_suspend
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.
--- drivers/dma/stm32/stm32-mdma.c | 1 + 1 file changed, 1 insertion(+)
drivers/dma/stm32/stm32-mdma.c +1 -0
@@ -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 ; } }
Quoted 11 lines · Xiangwu Lai
stm32_mdma_pm_suspend()increments the runtime PM usage counter withpm_runtime_resume_and_get(), but when a channel is still enabled it returns-EBUSYdirectly without dropping the reference. The matchingpm_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 <[email protected]>
Thanks for your patch,
Quoted 19 lines
--- drivers/dma/stm32/stm32-mdma.c | 1 + 1 file changed, 1 insertion(+)drivers/dma/stm32/stm32-mdma.c +1
-0@@ -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 ; } }
Quoted 7 lines · Xiangwu Lai
[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
stm32_mdma_pm_suspend()increments the runtime PM usage counter withpm_runtime_resume_and_get(), but when a channel is still enabled it returns-EBUSYdirectly without dropping the reference. The matchingpm_runtime_put_sync()only runs on the success path.
Quoted 6 lines
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 <[email protected]>
Quoted 19 lines
--- drivers/dma/stm32/stm32-mdma.c | 1 + 1 file changed, 1 insertion(+)drivers/dma/stm32/stm32-mdma.c +1
-0@@ -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 ; } }
Re: [PATCH] dmaengine: stm32-mdma: Fix runtime PM reference leak in pm_suspend()
In reply to Xiangwu LaiHi Vinod,
gentle ping on this patch:
[PATCH] dmaengine: stm32-mdma: Fix runtime PM reference leak in pm_suspend()
https://lore.kernel.org/r/[email protected]
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:
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/[email protected]
Could these two be queued for the next merge window?
Thanks,
Xiangwu Lai
Quoted 10 lines · Xiangwu Lai
stm32_mdma_pm_suspend()increments the runtime PM usage counter withpm_runtime_resume_and_get(), but when a channel is still enabled it returns-EBUSYdirectly without dropping the reference. The matchingpm_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,
Signature · 1 line
~Vinod