dmaengine: ti: edma: fix pm_runtime usage counter leak on error
Subsystems (2)
PATCH v2 1/2 dmaengine: ti: edma: fix pm_runtime usage counter leak on error
From: bui duc phuc <[email protected]>
pm_runtime_get_sync() leaves the runtime PM usage counter incremented even when it fails, but the error path in edma_probe() does not call pm_runtime_put_noidle() to balance it, leaking a reference each time resume fails.
Use pm_runtime_resume_and_get() instead, which automatically drops the usage counter on failure, fixing the leak.
---
Changes in v2:
- Update the commit message: Change the function name from netcp_probe() to edma_probe().
drivers/dma/ti/edma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/ti/edma.c +2 -2
@@ -2345,9 +2345,9 @@ static int edma_probe(struct platform_device *pdev)platform_set_drvdata (pdev, ecc);pm_runtime_enable (dev); - ret =pm_runtime_get_sync (dev); + ret =pm_runtime_resume_and_get (dev);if (ret <0 ) { -dev_err (dev,"pm_runtime_get_sync() failed\n" ); +dev_err (dev,"pm_runtime_resume_and_get() failed\n" );pm_runtime_disable (dev);return ret; }
Signature · 1 line
2.43.0
PATCH v2 2/2 dmaengine: ti: edma: Fix missing pm_runtime cleanup on probe failure
From: bui duc phuc <[email protected]>
pm_runtime_get_sync() errors were not checked, so on failure the usage count leaked and pm_runtime_enable() was never undone, leaving runtime PM in a half-initialized state after a failed probe.
Switch to pm_runtime_resume_and_get(), which cleans up the usage count internally on error, and call pm_runtime_disable() to balance the earlier pm_runtime_enable() on that path.
--- drivers/dma/ti/edma.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/dma/ti/edma.c +9 -1
@@ -2650,8 +2650,16 @@ static struct platform_driver edma_driver = {static int edma_tptc_probe (struct platform_device *pdev) { +int ret; +pm_runtime_enable (&pdev->dev); -return pm_runtime_get_sync (&pdev->dev); + ret =pm_runtime_resume_and_get (&pdev->dev); +if (ret <0 ) { +pm_runtime_disable (&pdev->dev); +return ret; + } + +return 0 ; }static struct platform_driver edma_tptc_driver = {
Signature · 1 line
2.43.0
Quoted 7 lines · On Wed, Sep 23, 2026 at 02:25:31PM +0700, [email protected] wrote:
From: bui duc phuc <[email protected]>
pm_runtime_get_sync()leaves the runtime PM usage counter incremented even when it fails, but the error path inedma_probe()does not callpm_runtime_put_noidle()to balance it, leaking a reference each time resume fails.
Quoted 6 lines
Use
pm_runtime_resume_and_get()instead, which automatically drops the usage counter on failure, fixing the leak.Fixes 2a03c1314506 ("dmaengine: ti: edma: add missed operations")Signed-off-by bui duc phuc <[email protected]>---
Quoted 27 lines
Changes in v2:
- Update the commit message: Change the function name fromnetcp_probe()toedma_probe().drivers/dma/ti/edma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/dma/ti/edma.c +2
-3@@ -2345,9 +2345,9 @@ static int edma_probe(struct platform_device *pdev)platform_set_drvdata (pdev, ecc);pm_runtime_enable (dev); - ret =pm_runtime_get_sync (dev); + ret =pm_runtime_resume_and_get (dev);if (ret <0 ) { -dev_err (dev,"pm_runtime_get_sync() failed\n" ); +dev_err (dev,"pm_runtime_resume_and_get() failed\n" );pm_runtime_disable (dev);return ret; } --2.43.0
Re: [PATCH v2 2/2] dmaengine: ti: edma: Fix missing pm_runtime cleanup on probe failure
In reply to [email protected]Quoted 6 lines · On Wed, Sep 23, 2026 at 02:25:32PM +0700, [email protected] wrote:
From: bui duc phuc <[email protected]>
pm_runtime_get_sync()errors were not checked, so on failure the usage count leaked andpm_runtime_enable()was never undone, leaving runtime PM in a half-initialized state after a failed probe.
Quoted 7 lines
Switch to
pm_runtime_resume_and_get(), which cleans up the usage count internally on error, and callpm_runtime_disable()to balance the earlierpm_runtime_enable()on that path.Fixes 23f49fd2ea9b ("dmaengine: edma: Remove dynamic TPTC power management feature")Signed-off-by bui duc phuc <[email protected]>---
Quoted 28 lines
drivers/dma/ti/edma.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)drivers/dma/ti/edma.c +9
-2@@ -2650,8 +2650,16 @@ static struct platform_driver edma_driver = {static int edma_tptc_probe (struct platform_device *pdev) { +int ret; +pm_runtime_enable (&pdev->dev); -return pm_runtime_get_sync (&pdev->dev); + ret =pm_runtime_resume_and_get (&pdev->dev); +if (ret <0 ) { +pm_runtime_disable (&pdev->dev); +return ret; + } + +return 0 ; }static struct platform_driver edma_tptc_driver = { --2.43.0
Quoted 9 lines · On Wed, 23 Sep 2026 14:25:31 +0700, [email protected] wrote:
pm_runtime_get_sync()leaves the runtime PM usage counter incremented even when it fails, but the error path inedma_probe()does not callpm_runtime_put_noidle()to balance it, leaking a reference each time resume fails.Use
pm_runtime_resume_and_get()instead, which automatically drops the usage counter on failure, fixing the leak.[...]
Applied, thanks!
[1/2] dmaengine: ti: edma: fix pm_runtime usage counter leak on error
commit: 98316e6234ad9e77e6d6605bd8166d4ad775aac0
[2/2] dmaengine: ti: edma: Fix missing pm_runtime cleanup on probe failure
commit: 89eb5862847e437dbc9c776c6d5019d396241e8bBest regards,
Signature · 1 line
~Vinod