diff mbox series

PCI: cadence: fix runtime pm imbalance on error

Message ID 20200520090253.2761-1-dinghao.liu@zju.edu.cn
State New
Headers show
Series PCI: cadence: fix runtime pm imbalance on error | expand

Commit Message

Dinghao Liu May 20, 2020, 9:02 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/cadence/pcie-cadence-plat.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Lorenzo Pieralisi July 6, 2020, 11:12 a.m. UTC | #1
On Wed, May 20, 2020 at 05:02:53PM +0800, 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.
> 
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> ---
>  drivers/pci/controller/cadence/pcie-cadence-plat.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/controller/cadence/pcie-cadence-plat.c b/drivers/pci/controller/cadence/pcie-cadence-plat.c
> index f5c6bf6dfcb8..33c3868e6dbd 100644
> --- a/drivers/pci/controller/cadence/pcie-cadence-plat.c
> +++ b/drivers/pci/controller/cadence/pcie-cadence-plat.c
> @@ -115,9 +115,8 @@ static int cdns_plat_pcie_probe(struct platform_device *pdev)
>  	}
>  
>   err_init:
> -	pm_runtime_put_sync(dev);
> -
>   err_get_sync:
> +	pm_runtime_put_sync(dev);
>  	pm_runtime_disable(dev);
>  	cdns_pcie_disable_phy(cdns_plat_pcie->pcie);
>  	phy_count = cdns_plat_pcie->pcie->phy_count;

Applied to pci/runtime-pm, thanks.

Lorenzo
diff mbox series

Patch

diff --git a/drivers/pci/controller/cadence/pcie-cadence-plat.c b/drivers/pci/controller/cadence/pcie-cadence-plat.c
index f5c6bf6dfcb8..33c3868e6dbd 100644
--- a/drivers/pci/controller/cadence/pcie-cadence-plat.c
+++ b/drivers/pci/controller/cadence/pcie-cadence-plat.c
@@ -115,9 +115,8 @@  static int cdns_plat_pcie_probe(struct platform_device *pdev)
 	}
 
  err_init:
-	pm_runtime_put_sync(dev);
-
  err_get_sync:
+	pm_runtime_put_sync(dev);
 	pm_runtime_disable(dev);
 	cdns_pcie_disable_phy(cdns_plat_pcie->pcie);
 	phy_count = cdns_plat_pcie->pcie->phy_count;