Skip to contentSkip to conversation

dmaengine: tegra210-adma: fix pm_runtime_get_sync failure

PATCH In review Navid Emamdoost 2 participants 2 messages Jun 3, 2020 – Jun 4, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dmaengine: tegra210-adma: fix pm_runtime_get_sync failure

Calling pm_runtime_get_sync increments the counter even in case of failure, causing incorrect ref count. Call pm_runtime_put if pm_runtime_get_sync fails.

---
 drivers/dma/tegra210-adma.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/dma/tegra210-adma.c +3 -1
index c4ce5dfb149b..87f2a1bed3aa 100644
@@ -869,8 +869,10 @@ static int tegra_adma_probe(struct platform_device *pdev)
 	pm_runtime_enable(&pdev->dev);
 
 	ret = pm_runtime_get_sync(&pdev->dev);
-	if (ret < 0)
+	if (ret < 0) {
+		pm_runtime_put_sync(&pdev->dev);
 		goto rpm_disable;
+	}
 
 	ret = tegra_adma_init(tdma);
 	if (ret)
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 14 lines · Navid Emamdoost

Calling pm_runtime_get_sync increments the counter even in case of failure, causing incorrect ref count. Call pm_runtime_put if pm_runtime_get_sync fails.

---
 drivers/dma/tegra210-adma.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/dma/tegra210-adma.c +0 -0
index c4ce5dfb149b..87f2a1bed3aa 100644

drivers/dma/tegra210-adma.c static int tegra_adma_probe(struct platform_device *pdev) · line 875

Quoted 8 lines
drivers/dma/tegra210-adma.c +3 -1
@@ -869,8 +869,10 @@ static int tegra_adma_probe(struct platform_device *pdev)
 	pm_runtime_enable(&pdev->dev);
 
 	ret = pm_runtime_get_sync(&pdev->dev);
-	if (ret < 0)
+	if (ret < 0) {
+		pm_runtime_put_sync(&pdev->dev);
 		goto rpm_disable;
+	}

I would prefer it if you did not add the pm_runtime_put_sync() call here because there is already one in the error path that can be used.

Jon

Signature · 1 line
nvpublic