Skip to contentSkip to conversation

PCI: tegra: handle failure case of pm_runtime_get_sync

PATCH In review Navid Emamdoost 2 participants 2 messages Jun 5, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: tegra: handle failure case of pm_runtime_get_sync

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.

---
 drivers/pci/controller/pci-tegra.c | 1 +
 1 file changed, 1 insertion(+)
drivers/pci/controller/pci-tegra.c +1 -0
index 3e64ba6a36a8..3d4b448fd8df 100644
@@ -2712,6 +2712,7 @@ static int tegra_pcie_probe(struct platform_device *pdev)
 	err = pm_runtime_get_sync(pcie->dev);
 	if (err < 0) {
 		dev_err(dev, "fail to enable pcie controller: %d\n", err);
+		pm_runtime_put_sync(pcie->dev);
 		goto teardown_msi;
 	}
 
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 14 lines · 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.

---
 drivers/pci/controller/pci-tegra.c | 1 +
 1 file changed, 1 insertion(+)
drivers/pci/controller/pci-tegra.c +0 -0
index 3e64ba6a36a8..3d4b448fd8df 100644

drivers/pci/controller/pci-tegra.c static int tegra_pcie_probe(struct platform_device *pdev) · line 2717

Quoted 6 lines
drivers/pci/controller/pci-tegra.c +1 -0
@@ -2712,6 +2712,7 @@ static int tegra_pcie_probe(struct platform_device *pdev)
 	err = pm_runtime_get_sync(pcie->dev);
 	if (err < 0) {
 		dev_err(dev, "fail to enable pcie controller: %d\n", err);
+		pm_runtime_put_sync(pcie->dev);
 		goto teardown_msi;
 	}

Same thing for this patch, there is already a put in the error path and so it is not necessary to add the put call here. Just update the goto label.

Jon

Signature · 1 line
nvpublic