diff mbox series

PCI: rcar: fix runtime pm imbalance on error

Message ID 20200520082228.26881-1-dinghao.liu@zju.edu.cn (mailing list archive)
State Accepted
Delegated to: Geert Uytterhoeven
Headers show
Series PCI: rcar: fix runtime pm imbalance on error | expand

Commit Message

Dinghao Liu May 20, 2020, 8:22 a.m. UTC
pm_runtime_get_sync() increments the runtime PM usage counter even
it returns an error code. Thus a pairing decrement is needed on
the error handling path to keep the counter balanced.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
 drivers/pci/controller/pcie-rcar.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Marek Vasut June 6, 2020, 12:15 p.m. UTC | #1
On 5/20/20 10:22 AM, Dinghao Liu wrote:
> pm_runtime_get_sync() increments the runtime PM usage counter even
> it returns an error code. Thus a pairing decrement is needed on
> the error handling path to keep the counter balanced.

Sorry for the late reply.

> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> ---
>  drivers/pci/controller/pcie-rcar.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/controller/pcie-rcar.c b/drivers/pci/controller/pcie-rcar.c
> index 759c6542c5c8..a9de65438051 100644
> --- a/drivers/pci/controller/pcie-rcar.c
> +++ b/drivers/pci/controller/pcie-rcar.c
> @@ -1207,9 +1207,8 @@ static int rcar_pcie_probe(struct platform_device *pdev)
>  	irq_dispose_mapping(pcie->msi.irq1);
>  
>  err_pm_put:

You might want to remove this label too.
I'm not runtime-pm expert to comment on the validity of this patch though.

> -	pm_runtime_put(dev);
> -
>  err_pm_disable:
> +	pm_runtime_put(dev);
>  	pm_runtime_disable(dev);
>  	pci_free_resource_list(&pcie->resources);
>  
>
Dinghao Liu June 7, 2020, 6:18 a.m. UTC | #2
> >  
> >  err_pm_put:
> 
> You might want to remove this label too.

Thank you for pointing out this! I will fix this in the 
next version of patch.
diff mbox series

Patch

diff --git a/drivers/pci/controller/pcie-rcar.c b/drivers/pci/controller/pcie-rcar.c
index 759c6542c5c8..a9de65438051 100644
--- a/drivers/pci/controller/pcie-rcar.c
+++ b/drivers/pci/controller/pcie-rcar.c
@@ -1207,9 +1207,8 @@  static int rcar_pcie_probe(struct platform_device *pdev)
 	irq_dispose_mapping(pcie->msi.irq1);
 
 err_pm_put:
-	pm_runtime_put(dev);
-
 err_pm_disable:
+	pm_runtime_put(dev);
 	pm_runtime_disable(dev);
 	pci_free_resource_list(&pcie->resources);