linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: rcar: Fix runtime PM imbalance in rcar_pcie_ep_probe
@ 2021-04-08  7:24 Dinghao Liu
  2021-06-21 11:58 ` Geert Uytterhoeven
  2021-08-05 13:09 ` Lorenzo Pieralisi
  0 siblings, 2 replies; 3+ messages in thread
From: Dinghao Liu @ 2021-04-08  7:24 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() will increase the runtime PM counter
even it returns an error. Thus a pairing decrement is needed
to prevent refcount leak. Fix this by replacing this API with
pm_runtime_resume_and_get(), which will not change the runtime
PM counter on error.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
 drivers/pci/controller/pcie-rcar-ep.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/controller/pcie-rcar-ep.c b/drivers/pci/controller/pcie-rcar-ep.c
index b4a288e24aaf..c91d85b15129 100644
--- a/drivers/pci/controller/pcie-rcar-ep.c
+++ b/drivers/pci/controller/pcie-rcar-ep.c
@@ -492,9 +492,9 @@ static int rcar_pcie_ep_probe(struct platform_device *pdev)
 	pcie->dev = dev;
 
 	pm_runtime_enable(dev);
-	err = pm_runtime_get_sync(dev);
+	err = pm_runtime_resume_and_get(dev);
 	if (err < 0) {
-		dev_err(dev, "pm_runtime_get_sync failed\n");
+		dev_err(dev, "pm_runtime_resume_and_get failed\n");
 		goto err_pm_disable;
 	}
 
-- 
2.17.1


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

* Re: [PATCH] PCI: rcar: Fix runtime PM imbalance in rcar_pcie_ep_probe
  2021-04-08  7:24 [PATCH] PCI: rcar: Fix runtime PM imbalance in rcar_pcie_ep_probe Dinghao Liu
@ 2021-06-21 11:58 ` Geert Uytterhoeven
  2021-08-05 13:09 ` Lorenzo Pieralisi
  1 sibling, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2021-06-21 11:58 UTC (permalink / raw)
  To: Dinghao Liu
  Cc: Kangjie Lu, Marek Vasut, Yoshihiro Shimoda, Lorenzo Pieralisi,
	Rob Herring, Bjorn Helgaas, linux-pci, Linux-Renesas,
	Linux Kernel Mailing List

On Thu, Apr 8, 2021 at 9:24 AM Dinghao Liu <dinghao.liu@zju.edu.cn> wrote:
> pm_runtime_get_sync() will increase the runtime PM counter
> even it returns an error. Thus a pairing decrement is needed
> to prevent refcount leak. Fix this by replacing this API with
> pm_runtime_resume_and_get(), which will not change the runtime
> PM counter on error.
>
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH] PCI: rcar: Fix runtime PM imbalance in rcar_pcie_ep_probe
  2021-04-08  7:24 [PATCH] PCI: rcar: Fix runtime PM imbalance in rcar_pcie_ep_probe Dinghao Liu
  2021-06-21 11:58 ` Geert Uytterhoeven
@ 2021-08-05 13:09 ` Lorenzo Pieralisi
  1 sibling, 0 replies; 3+ messages in thread
From: Lorenzo Pieralisi @ 2021-08-05 13:09 UTC (permalink / raw)
  To: kjlu, Dinghao Liu
  Cc: Lorenzo Pieralisi, linux-renesas-soc, Rob Herring, Bjorn Helgaas,
	Marek Vasut, linux-kernel, Yoshihiro Shimoda, linux-pci

On Thu, 8 Apr 2021 15:24:02 +0800, Dinghao Liu wrote:
> pm_runtime_get_sync() will increase the runtime PM counter
> even it returns an error. Thus a pairing decrement is needed
> to prevent refcount leak. Fix this by replacing this API with
> pm_runtime_resume_and_get(), which will not change the runtime
> PM counter on error.

Applied to pci/rcar, thanks!

[1/1] PCI: rcar: Fix runtime PM imbalance in rcar_pcie_ep_probe()
      https://git.kernel.org/lpieralisi/pci/c/1e29cd9983

Thanks,
Lorenzo

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

end of thread, other threads:[~2021-08-05 13:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-08  7:24 [PATCH] PCI: rcar: Fix runtime PM imbalance in rcar_pcie_ep_probe Dinghao Liu
2021-06-21 11:58 ` Geert Uytterhoeven
2021-08-05 13:09 ` 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).