Linux-PCI Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] PCI: cadence: fix runtime pm imbalance on error
@ 2020-05-20  9:02 Dinghao Liu
  2020-07-06 11:12 ` Lorenzo Pieralisi
  0 siblings, 1 reply; 2+ messages in thread
From: Dinghao Liu @ 2020-05-20  9:02 UTC (permalink / raw)
  To: dinghao.liu, kjlu
  Cc: Tom Joseph, Lorenzo Pieralisi, Rob Herring, Bjorn Helgaas,
	linux-pci, linux-kernel

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;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] PCI: cadence: fix runtime pm imbalance on error
  2020-05-20  9:02 [PATCH] PCI: cadence: fix runtime pm imbalance on error Dinghao Liu
@ 2020-07-06 11:12 ` Lorenzo Pieralisi
  0 siblings, 0 replies; 2+ messages in thread
From: Lorenzo Pieralisi @ 2020-07-06 11:12 UTC (permalink / raw)
  To: Dinghao Liu
  Cc: kjlu, Tom Joseph, Rob Herring, Bjorn Helgaas, linux-pci, linux-kernel

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-20  9:02 [PATCH] PCI: cadence: fix runtime pm imbalance on error Dinghao Liu
2020-07-06 11:12 ` Lorenzo Pieralisi

Linux-PCI Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-pci/0 linux-pci/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-pci linux-pci/ https://lore.kernel.org/linux-pci \
		linux-pci@vger.kernel.org
	public-inbox-index linux-pci

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-pci


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git