* [PATCH] PCI: qcom: fix runtime pm imbalance on error
@ 2020-05-20 8:58 Dinghao Liu
2020-07-06 9:58 ` Lorenzo Pieralisi
0 siblings, 1 reply; 3+ messages in thread
From: Dinghao Liu @ 2020-05-20 8:58 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>
---
drivers/pci/controller/dwc/pcie-qcom.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
index 138e1a2d21cc..35686930df1d 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -1340,8 +1340,7 @@ 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;
+ goto err_pm_runtime_put;
}
pci->dev = dev;
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] PCI: qcom: fix runtime pm imbalance on error
2020-05-20 8:58 [PATCH] PCI: qcom: fix runtime pm imbalance on error Dinghao Liu
@ 2020-07-06 9:58 ` Lorenzo Pieralisi
2020-07-07 2:13 ` dinghao.liu
0 siblings, 1 reply; 3+ messages in thread
From: Lorenzo Pieralisi @ 2020-07-06 9:58 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 Wed, May 20, 2020 at 04:58:37PM +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/dwc/pcie-qcom.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
> index 138e1a2d21cc..35686930df1d 100644
> --- a/drivers/pci/controller/dwc/pcie-qcom.c
> +++ b/drivers/pci/controller/dwc/pcie-qcom.c
> @@ -1340,8 +1340,7 @@ 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;
> + goto err_pm_runtime_put;
I think you need to remove the brackets - this become a single line
if statement.
Lorenzo
> }
>
> pci->dev = dev;
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Re: [PATCH] PCI: qcom: fix runtime pm imbalance on error
2020-07-06 9:58 ` Lorenzo Pieralisi
@ 2020-07-07 2:13 ` dinghao.liu
0 siblings, 0 replies; 3+ messages in thread
From: dinghao.liu @ 2020-07-07 2:13 UTC (permalink / raw)
To: Lorenzo Pieralisi
Cc: kjlu, Andy Gross, Bjorn Andersson, Stanimir Varbanov,
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>
> > ---
> > drivers/pci/controller/dwc/pcie-qcom.c | 3 +--
> > 1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
> > index 138e1a2d21cc..35686930df1d 100644
> > --- a/drivers/pci/controller/dwc/pcie-qcom.c
> > +++ b/drivers/pci/controller/dwc/pcie-qcom.c
> > @@ -1340,8 +1340,7 @@ 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;
> > + goto err_pm_runtime_put;
>
> I think you need to remove the brackets - this become a single line
> if statement.
>
Thank you for your advice! I will fix this in the next version of patch.
Regards,
Dinghao
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-07-07 2:14 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:58 [PATCH] PCI: qcom: fix runtime pm imbalance on error Dinghao Liu
2020-07-06 9:58 ` Lorenzo Pieralisi
2020-07-07 2:13 ` dinghao.liu
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).