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

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