Skip to contentSkip to conversation

dmaengine: stm32-dmamux: Fix PM disable depth imbalance in stm32_dmamux_probe

PATCH Applied Miaoqian Lin 3 participants 3 messages Jan 8, 2022 – Feb 15, 2022

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

PATCH 1/1 dmaengine: stm32-dmamux: Fix PM disable depth imbalance in stm32_dmamux_probe

The pm_runtime_enable will increase power disable depth. If the probe fails, we should use pm_runtime_disable() to balance pm_runtime_enable().

Fixes 4f3ceca254e0 ("dmaengine: stm32-dmamux: Add PM Runtime support")
---
 drivers/dma/stm32-dmamux.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/dma/stm32-dmamux.c +3 -1
index a42164389ebc..d5d55732adba 100644
@@ -292,10 +292,12 @@ static int stm32_dmamux_probe(struct platform_device *pdev)
 	ret = of_dma_router_register(node, stm32_dmamux_route_allocate,
 				     &stm32_dmamux->dmarouter);
 	if (ret)
-		goto err_clk;
+		goto pm_disable;
 
 	return 0;
 
+pm_disable:
+	pm_runtime_disable(&pdev->dev);
 err_clk:
 	clk_disable_unprepare(stm32_dmamux->clk);
 
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Miaoqian Lin

The pm_runtime_enable will increase power disable depth. If the probe fails, we should use pm_runtime_disable() to balance pm_runtime_enable().

Fixes 4f3ceca254e0 ("dmaengine: stm32-dmamux: Add PM Runtime support")

Thanks for your patch,

Quoted 23 lines
---
  drivers/dma/stm32-dmamux.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/dma/stm32-dmamux.c +3 -1
index a42164389ebc..d5d55732adba 100644
@@ -292,10 +292,12 @@ static int stm32_dmamux_probe(struct platform_device *pdev)
  	ret = of_dma_router_register(node, stm32_dmamux_route_allocate,
  				     &stm32_dmamux->dmarouter);
  	if (ret)
-		goto err_clk;
+		goto pm_disable;
 
  	return 0;
 
+pm_disable:
+	pm_runtime_disable(&pdev->dev);
  err_clk:
  	clk_disable_unprepare(stm32_dmamux->clk);
 
maintainer Applied
#2 lore raw
In reply to Miaoqian Lin
Quoted 3 lines · Miaoqian Lin

The pm_runtime_enable will increase power disable depth. If the probe fails, we should use pm_runtime_disable() to balance pm_runtime_enable().

Applied, thanks

Signature · 1 line
~Vinod