Linux-PCI Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] [v2] PCI: rcar: Fix runtime PM imbalance on error
@ 2020-06-07  9:31 Dinghao Liu
  2020-06-08  1:49 ` Yoshihiro Shimoda
  2020-07-07 11:16 ` Lorenzo Pieralisi
  0 siblings, 2 replies; 4+ messages in thread
From: Dinghao Liu @ 2020-06-07  9:31 UTC (permalink / raw)
  To: dinghao.liu, kjlu
  Cc: Marek Vasut, Yoshihiro Shimoda, Lorenzo Pieralisi, Rob Herring,
	Bjorn Helgaas, linux-pci, linux-renesas-soc, linux-kernel

pm_runtime_get_sync() increments the runtime PM usage counter even
the call returns an error code. Thus a corresponding 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 unnecessary 'err_pm_put' label.
      Refine commit message.
---
 drivers/pci/controller/pcie-rcar.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/controller/pcie-rcar.c b/drivers/pci/controller/pcie-rcar.c
index 759c6542c5c8..f9595ab54bc4 100644
--- a/drivers/pci/controller/pcie-rcar.c
+++ b/drivers/pci/controller/pcie-rcar.c
@@ -1143,7 +1143,7 @@ static int rcar_pcie_probe(struct platform_device *pdev)
 	err = rcar_pcie_get_resources(pcie);
 	if (err < 0) {
 		dev_err(dev, "failed to request resources: %d\n", err);
-		goto err_pm_put;
+		goto err_pm_disable;
 	}
 
 	err = clk_prepare_enable(pcie->bus_clk);
@@ -1206,10 +1206,8 @@ static int rcar_pcie_probe(struct platform_device *pdev)
 	irq_dispose_mapping(pcie->msi.irq2);
 	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);
 
-- 
2.17.1


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

* RE: [PATCH] [v2] PCI: rcar: Fix runtime PM imbalance on error
  2020-06-07  9:31 [PATCH] [v2] PCI: rcar: Fix runtime PM imbalance on error Dinghao Liu
@ 2020-06-08  1:49 ` Yoshihiro Shimoda
  2020-07-07 11:16 ` Lorenzo Pieralisi
  1 sibling, 0 replies; 4+ messages in thread
From: Yoshihiro Shimoda @ 2020-06-08  1:49 UTC (permalink / raw)
  To: Dinghao Liu, kjlu
  Cc: Marek Vasut, Lorenzo Pieralisi, Rob Herring, Bjorn Helgaas,
	linux-pci, linux-renesas-soc, linux-kernel

Hi Dinghao,

> From: Dinghao Liu, Sent: Sunday, June 7, 2020 6:32 PM
> 
> pm_runtime_get_sync() increments the runtime PM usage counter even
> the call returns an error code. Thus a corresponding decrement is
> needed on the error handling path to keep the counter balanced.
> 
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>

Thank you for your patch! I think we can add Fixes tag like below.

Fixes: 0df6150e7ceb ("PCI: rcar: Use runtime PM to control controller clock")

And, I reviewed this patch. So,

Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

Best regards,
Yoshihiro Shimoda

> ---
> 
> Changelog:
> 
> v2: - Remove unnecessary 'err_pm_put' label.
>       Refine commit message.
> ---
>  drivers/pci/controller/pcie-rcar.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pci/controller/pcie-rcar.c b/drivers/pci/controller/pcie-rcar.c
> index 759c6542c5c8..f9595ab54bc4 100644
> --- a/drivers/pci/controller/pcie-rcar.c
> +++ b/drivers/pci/controller/pcie-rcar.c
> @@ -1143,7 +1143,7 @@ static int rcar_pcie_probe(struct platform_device *pdev)
>  	err = rcar_pcie_get_resources(pcie);
>  	if (err < 0) {
>  		dev_err(dev, "failed to request resources: %d\n", err);
> -		goto err_pm_put;
> +		goto err_pm_disable;
>  	}
> 
>  	err = clk_prepare_enable(pcie->bus_clk);
> @@ -1206,10 +1206,8 @@ static int rcar_pcie_probe(struct platform_device *pdev)
>  	irq_dispose_mapping(pcie->msi.irq2);
>  	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);
> 
> --
> 2.17.1


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

* Re: [PATCH] [v2] PCI: rcar: Fix runtime PM imbalance on error
  2020-06-07  9:31 [PATCH] [v2] PCI: rcar: Fix runtime PM imbalance on error Dinghao Liu
  2020-06-08  1:49 ` Yoshihiro Shimoda
@ 2020-07-07 11:16 ` Lorenzo Pieralisi
  2020-07-09  6:31   ` dinghao.liu
  1 sibling, 1 reply; 4+ messages in thread
From: Lorenzo Pieralisi @ 2020-07-07 11:16 UTC (permalink / raw)
  To: Dinghao Liu
  Cc: kjlu, Marek Vasut, Yoshihiro Shimoda, Rob Herring, Bjorn Helgaas,
	linux-pci, linux-renesas-soc, linux-kernel

On Sun, Jun 07, 2020 at 05:31:33PM +0800, Dinghao Liu wrote:
> pm_runtime_get_sync() increments the runtime PM usage counter even
> the call returns an error code. Thus a corresponding 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 unnecessary 'err_pm_put' label.
>       Refine commit message.
> ---
>  drivers/pci/controller/pcie-rcar.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)

Can you rebase it on top of v5.8-rc1 and resend it with Yoshihiro's tags
please ?

Thanks,
Lorenzo

> diff --git a/drivers/pci/controller/pcie-rcar.c b/drivers/pci/controller/pcie-rcar.c
> index 759c6542c5c8..f9595ab54bc4 100644
> --- a/drivers/pci/controller/pcie-rcar.c
> +++ b/drivers/pci/controller/pcie-rcar.c
> @@ -1143,7 +1143,7 @@ static int rcar_pcie_probe(struct platform_device *pdev)
>  	err = rcar_pcie_get_resources(pcie);
>  	if (err < 0) {
>  		dev_err(dev, "failed to request resources: %d\n", err);
> -		goto err_pm_put;
> +		goto err_pm_disable;
>  	}
>  
>  	err = clk_prepare_enable(pcie->bus_clk);
> @@ -1206,10 +1206,8 @@ static int rcar_pcie_probe(struct platform_device *pdev)
>  	irq_dispose_mapping(pcie->msi.irq2);
>  	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);
>  
> -- 
> 2.17.1
> 

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

* Re: Re: [PATCH] [v2] PCI: rcar: Fix runtime PM imbalance on error
  2020-07-07 11:16 ` Lorenzo Pieralisi
@ 2020-07-09  6:31   ` dinghao.liu
  0 siblings, 0 replies; 4+ messages in thread
From: dinghao.liu @ 2020-07-09  6:31 UTC (permalink / raw)
  To: Lorenzo Pieralisi
  Cc: kjlu, Marek Vasut, Yoshihiro Shimoda, Rob Herring, Bjorn Helgaas,
	linux-pci, linux-renesas-soc, linux-kernel

> On Sun, Jun 07, 2020 at 05:31:33PM +0800, Dinghao Liu wrote:
> > pm_runtime_get_sync() increments the runtime PM usage counter even
> > the call returns an error code. Thus a corresponding 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 unnecessary 'err_pm_put' label.
> >       Refine commit message.
> > ---
> >  drivers/pci/controller/pcie-rcar.c | 6 ++----
> >  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> Can you rebase it on top of v5.8-rc1 and resend it with Yoshihiro's tags
> please ?
> 

Sure, I will resend it soon.

Regards,
Dinghao

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

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-07  9:31 [PATCH] [v2] PCI: rcar: Fix runtime PM imbalance on error Dinghao Liu
2020-06-08  1:49 ` Yoshihiro Shimoda
2020-07-07 11:16 ` Lorenzo Pieralisi
2020-07-09  6:31   ` dinghao.liu

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