All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PCI: rcar: fix runtime pm imbalance on error
@ 2020-05-20  8:22 Dinghao Liu
  2020-06-06 12:15 ` Marek Vasut
  0 siblings, 1 reply; 3+ messages in thread
From: Dinghao Liu @ 2020-05-20  8:22 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
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(-)

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


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

* Re: [PATCH] PCI: rcar: fix runtime pm imbalance on error
  2020-05-20  8:22 [PATCH] PCI: rcar: fix runtime pm imbalance on error Dinghao Liu
@ 2020-06-06 12:15 ` Marek Vasut
  2020-06-07  6:18   ` dinghao.liu
  0 siblings, 1 reply; 3+ messages in thread
From: Marek Vasut @ 2020-06-06 12:15 UTC (permalink / raw)
  To: Dinghao Liu, kjlu
  Cc: Yoshihiro Shimoda, Lorenzo Pieralisi, Rob Herring, Bjorn Helgaas,
	linux-pci, linux-renesas-soc, linux-kernel

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

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

* Re: Re: [PATCH] PCI: rcar: fix runtime pm imbalance on error
  2020-06-06 12:15 ` Marek Vasut
@ 2020-06-07  6:18   ` dinghao.liu
  0 siblings, 0 replies; 3+ messages in thread
From: dinghao.liu @ 2020-06-07  6:18 UTC (permalink / raw)
  To: Marek Vasut
  Cc: kjlu, Yoshihiro Shimoda, Lorenzo Pieralisi, Rob Herring,
	Bjorn Helgaas, linux-pci, linux-renesas-soc, linux-kernel

> >  
> >  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.

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

end of thread, other threads:[~2020-06-07  6:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-20  8:22 [PATCH] PCI: rcar: fix runtime pm imbalance on error Dinghao Liu
2020-06-06 12:15 ` Marek Vasut
2020-06-07  6:18   ` dinghao.liu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.