* [PATCH] PCI: rcar: handle the failure case of pm_runtime_get_sync
@ 2020-06-05 3:23 Navid Emamdoost
2020-06-06 12:17 ` Marek Vasut
0 siblings, 1 reply; 2+ messages in thread
From: Navid Emamdoost @ 2020-06-05 3:23 UTC (permalink / raw)
To: Marek Vasut, Yoshihiro Shimoda, Lorenzo Pieralisi, Rob Herring,
Bjorn Helgaas, linux-pci, linux-renesas-soc, linux-kernel
Cc: emamd001, wu000273, kjlu, smccaman, Navid Emamdoost
Calling pm_runtime_get_sync increments the counter even in case of
failure, causing incorrect ref count. Call pm_runtime_put if
pm_runtime_get_sync fails.
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
drivers/pci/controller/pcie-rcar.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/pci/controller/pcie-rcar.c b/drivers/pci/controller/pcie-rcar.c
index 759c6542c5c8..6b4181c0710e 100644
--- a/drivers/pci/controller/pcie-rcar.c
+++ b/drivers/pci/controller/pcie-rcar.c
@@ -1137,7 +1137,7 @@ static int rcar_pcie_probe(struct platform_device *pdev)
err = pm_runtime_get_sync(pcie->dev);
if (err < 0) {
dev_err(pcie->dev, "pm_runtime_get_sync failed\n");
- goto err_pm_disable;
+ goto err_pm_put;
}
err = rcar_pcie_get_resources(pcie);
@@ -1208,8 +1208,6 @@ static int rcar_pcie_probe(struct platform_device *pdev)
err_pm_put:
pm_runtime_put(dev);
-
-err_pm_disable:
pm_runtime_disable(dev);
pci_free_resource_list(&pcie->resources);
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] PCI: rcar: handle the failure case of pm_runtime_get_sync
2020-06-05 3:23 [PATCH] PCI: rcar: handle the failure case of pm_runtime_get_sync Navid Emamdoost
@ 2020-06-06 12:17 ` Marek Vasut
0 siblings, 0 replies; 2+ messages in thread
From: Marek Vasut @ 2020-06-06 12:17 UTC (permalink / raw)
To: Navid Emamdoost, Marek Vasut, Yoshihiro Shimoda,
Lorenzo Pieralisi, Rob Herring, Bjorn Helgaas, linux-pci,
linux-renesas-soc, linux-kernel
Cc: emamd001, wu000273, kjlu, smccaman
On 6/5/20 5:23 AM, Navid Emamdoost wrote:
> Calling pm_runtime_get_sync increments the counter even in case of
> failure, causing incorrect ref count. Call pm_runtime_put if
> pm_runtime_get_sync fails.
>
> Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
This looks like a V2 of
[PATCH] PCI: rcar: fix runtime pm imbalance on error
This looks good to me, but I'm no runtime-pm expert.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-06-06 12:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-05 3:23 [PATCH] PCI: rcar: handle the failure case of pm_runtime_get_sync Navid Emamdoost
2020-06-06 12:17 ` Marek Vasut
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).