linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [v2] PCI: qcom: Fix runtime PM imbalance on error
@ 2020-07-07  5:50 Dinghao Liu
  2020-07-07 10:36 ` Lorenzo Pieralisi
  0 siblings, 1 reply; 2+ messages in thread
From: Dinghao Liu @ 2020-07-07  5:50 UTC (permalink / raw)
  To: dinghao.liu, kjlu
  Cc: Andy Gross, Bjorn Andersson, Stanimir Varbanov,
	Lorenzo Pieralisi, Rob Herring, Bjorn Helgaas, linux-arm-msm,
	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>
---

Changelog:

v2: - Remove redundant brackets.
---
 drivers/pci/controller/dwc/pcie-qcom.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
index 138e1a2d21cc..12abdfbff5ca 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -1339,10 +1339,8 @@ static int qcom_pcie_probe(struct platform_device *pdev)
 
 	pm_runtime_enable(dev);
 	ret = pm_runtime_get_sync(dev);
-	if (ret < 0) {
-		pm_runtime_disable(dev);
-		return ret;
-	}
+	if (ret < 0)
+		goto err_pm_runtime_put;
 
 	pci->dev = dev;
 	pci->ops = &dw_pcie_ops;
-- 
2.17.1


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

* Re: [PATCH] [v2] PCI: qcom: Fix runtime PM imbalance on error
  2020-07-07  5:50 [PATCH] [v2] PCI: qcom: Fix runtime PM imbalance on error Dinghao Liu
@ 2020-07-07 10:36 ` Lorenzo Pieralisi
  0 siblings, 0 replies; 2+ messages in thread
From: Lorenzo Pieralisi @ 2020-07-07 10:36 UTC (permalink / raw)
  To: Dinghao Liu
  Cc: kjlu, Andy Gross, Bjorn Andersson, Stanimir Varbanov,
	Rob Herring, Bjorn Helgaas, linux-arm-msm, linux-pci,
	linux-kernel

On Tue, Jul 07, 2020 at 01:50:00PM +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>
> ---
> 
> Changelog:
> 
> v2: - Remove redundant brackets.
> ---
>  drivers/pci/controller/dwc/pcie-qcom.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)

Applied to pci/runtime-pm, thanks.

Lorenzo

> diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
> index 138e1a2d21cc..12abdfbff5ca 100644
> --- a/drivers/pci/controller/dwc/pcie-qcom.c
> +++ b/drivers/pci/controller/dwc/pcie-qcom.c
> @@ -1339,10 +1339,8 @@ static int qcom_pcie_probe(struct platform_device *pdev)
>  
>  	pm_runtime_enable(dev);
>  	ret = pm_runtime_get_sync(dev);
> -	if (ret < 0) {
> -		pm_runtime_disable(dev);
> -		return ret;
> -	}
> +	if (ret < 0)
> +		goto err_pm_runtime_put;
>  
>  	pci->dev = dev;
>  	pci->ops = &dw_pcie_ops;
> -- 
> 2.17.1
> 

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

end of thread, other threads:[~2020-07-07 10:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-07  5:50 [PATCH] [v2] PCI: qcom: Fix runtime PM imbalance on error Dinghao Liu
2020-07-07 10:36 ` Lorenzo Pieralisi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).