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

Miaoqian Lin posted 1 patch 4 years, 5 months ago
drivers/dma/stm32-dmamux.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
[PATCH] dmaengine: stm32-dmamux: Fix PM disable depth imbalance in stm32_dmamux_probe
Posted by Miaoqian Lin 4 years, 5 months ago
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")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/dma/stm32-dmamux.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/stm32-dmamux.c b/drivers/dma/stm32-dmamux.c
index a42164389ebc..d5d55732adba 100644
--- a/drivers/dma/stm32-dmamux.c
+++ b/drivers/dma/stm32-dmamux.c
@@ -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);
 
-- 
2.17.1

Re: [Linux-stm32] [PATCH] dmaengine: stm32-dmamux: Fix PM disable depth imbalance in stm32_dmamux_probe
Posted by Amelie DELAUNAY 4 years, 5 months ago
On 1/8/22 9:53 AM, Miaoqian Lin wrote:
> 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")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>

Thanks for your patch,

Reviewed-by: Amelie Delaunay <amelie.delaunay@foss.st.com>

> ---
>   drivers/dma/stm32-dmamux.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/stm32-dmamux.c b/drivers/dma/stm32-dmamux.c
> index a42164389ebc..d5d55732adba 100644
> --- a/drivers/dma/stm32-dmamux.c
> +++ b/drivers/dma/stm32-dmamux.c
> @@ -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);
>   
> 
Re: [PATCH] dmaengine: stm32-dmamux: Fix PM disable depth imbalance in stm32_dmamux_probe
Posted by Vinod Koul 4 years, 4 months ago
On 08-01-22, 08:53, Miaoqian Lin wrote:
> 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

-- 
~Vinod