Skip to contentSkip to conversation

PCI: tegra: Correctly handle return code of pm_runtime_get_sync()

PATCH In review David Engraf 4 participants 8 messages Dec 16, 2019 – Jan 10, 2020

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

PATCH 1/1 PCI: tegra: Correctly handle return code of pm_runtime_get_sync()

pm_runtime_get_sync() returns the device's usage counter. This might be >0 if the device is already powered up or CONFIG_PM is disabled.

Abort probe function on real error only.

---
 drivers/pci/controller/pci-tegra.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/pci-tegra.c +1 -1
index 673a1725ef38..090b632965e2 100644
@@ -2798,7 +2798,7 @@ static int tegra_pcie_probe(struct platform_device *pdev)
 
 	pm_runtime_enable(pcie->dev);
 	err = pm_runtime_get_sync(pcie->dev);
-	if (err) {
+	if (err < 0) {
 		dev_err(dev, "fail to enable pcie controller: %d\n", err);
 		goto teardown_msi;
 	}
Signature · 1 line
2.17.1
#1 lore raw
Quoted 6 lines · David Engraf

pm_runtime_get_sync() returns the device's usage counter. This might be >0 if the device is already powered up or CONFIG_PM is disabled.

Abort probe function on real error only.

Thanks for this, looks OK to me.

As this is a fix, can you add the following fixes tag?

Fixes da76ba50963b ("PCI: tegra: Add power management support")

And whilst doing that can you rename the subject to "PCI: tegra: Fix return value check of pm_runtime_get_sync" - it's slightly shorter and has the word fix in the title.

Thanks,

Andrew Murray

Quoted 20 lines
---
 drivers/pci/controller/pci-tegra.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/pci-tegra.c +1 -1
index 673a1725ef38..090b632965e2 100644
@@ -2798,7 +2798,7 @@ static int tegra_pcie_probe(struct platform_device *pdev)
 
 	pm_runtime_enable(pcie->dev);
 	err = pm_runtime_get_sync(pcie->dev);
-	if (err) {
+	if (err < 0) {
 		dev_err(dev, "fail to enable pcie controller: %d\n", err);
 		goto teardown_msi;
 	}
Signature · 1 line
2.17.1
#2 lore raw

PATCH v2 1/1 PCI: tegra: Fix return value check of pm_runtime_get_sync

pm_runtime_get_sync() returns the device's usage counter. This might be >0 if the device is already powered up or CONFIG_PM is disabled.

Abort probe function on real error only.

Fixes da76ba50963b ("PCI: tegra: Add power management support")
---
 drivers/pci/controller/pci-tegra.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/pci-tegra.c +1 -1
index 673a1725ef38..090b632965e2 100644
@@ -2798,7 +2798,7 @@ static int tegra_pcie_probe(struct platform_device *pdev)
 
 	pm_runtime_enable(pcie->dev);
 	err = pm_runtime_get_sync(pcie->dev);
-	if (err) {
+	if (err < 0) {
 		dev_err(dev, "fail to enable pcie controller: %d\n", err);
 		goto teardown_msi;
 	}
Signature · 1 line
2.17.1
Acked-by on v2 1/1
#3 lore raw

Re: [PATCH v2] PCI: tegra: Fix return value check of pm_runtime_get_sync

Quoted 7 lines · David Engraf

pm_runtime_get_sync() returns the device's usage counter. This might be >0 if the device is already powered up or CONFIG_PM is disabled.

Abort probe function on real error only.

Fixes da76ba50963b ("PCI: tegra: Add power management support")

Thanks for this - apologies my feedback wasn't as quick as your respin.

Quoted 20 lines
---
 drivers/pci/controller/pci-tegra.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/pci-tegra.c +1 -1
index 673a1725ef38..090b632965e2 100644
@@ -2798,7 +2798,7 @@ static int tegra_pcie_probe(struct platform_device *pdev)
 
 	pm_runtime_enable(pcie->dev);
 	err = pm_runtime_get_sync(pcie->dev);
-	if (err) {
+	if (err < 0) {
 		dev_err(dev, "fail to enable pcie controller: %d\n", err);
 		goto teardown_msi;
 	}
Signature · 1 line
2.17.1
#4 lore raw

Re: [PATCH v2] PCI: tegra: Fix return value check of pm_runtime_get_sync

In reply to David Engraf
Quoted 7 lines · David Engraf

pm_runtime_get_sync() returns the device's usage counter. This might be >0 if the device is already powered up or CONFIG_PM is disabled.

Abort probe function on real error only.

Fixes da76ba50963b ("PCI: tegra: Add power management support")

I added Andrew's ack and a stable tag for v4.17+. Also cc'd Manikanta, author of da76ba50963b.

I put this on my pci/host-tegra branch for v5.6 for now. Lorenzo may move this when he returns.

Quoted 20 lines
---
 drivers/pci/controller/pci-tegra.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/pci-tegra.c +1 -1
index 673a1725ef38..090b632965e2 100644
@@ -2798,7 +2798,7 @@ static int tegra_pcie_probe(struct platform_device *pdev)
 
 	pm_runtime_enable(pcie->dev);
 	err = pm_runtime_get_sync(pcie->dev);
-	if (err) {
+	if (err < 0) {
 		dev_err(dev, "fail to enable pcie controller: %d\n", err);
 		goto teardown_msi;
 	}
Signature · 1 line
2.17.1
#5 lore raw

Re: [PATCH v2] PCI: tegra: Fix return value check of pm_runtime_get_sync

Quoted 6 lines · Bjorn Helgaas
Quoted 5 lines · David Engraf

pm_runtime_get_sync() returns the device's usage counter. This might be >0 if the device is already powered up or CONFIG_PM is disabled.

Abort probe function on real error only.

Quoted 8 lines
Quoted 2 lines
Fixes da76ba50963b ("PCI: tegra: Add power management support")

I added Andrew's ack and a stable tag for v4.17+. Also cc'd Manikanta, author of da76ba50963b.

I put this on my pci/host-tegra branch for v5.6 for now. Lorenzo may move this when he returns.

Hi Bjorn,

I could not find pci/host-tegra in your public repo, have you deleted it in the meanwhile ?

I am happy to merge it myself, asking to check if there is anything I am missing.

Thanks,
Lorenzo

#6 lore raw

Re: [PATCH v2] PCI: tegra: Fix return value check of pm_runtime_get_sync

Quoted 13 lines · Lorenzo Pieralisi
Quoted 12 lines · Bjorn Helgaas
Quoted 7 lines · David Engraf

pm_runtime_get_sync() returns the device's usage counter. This might be >0 if the device is already powered up or CONFIG_PM is disabled.

Abort probe function on real error only.

Fixes da76ba50963b ("PCI: tegra: Add power management support")

I added Andrew's ack and a stable tag for v4.17+. Also cc'd Manikanta, author of da76ba50963b.

Quoted 7 lines
Quoted 2 lines

I put this on my pci/host-tegra branch for v5.6 for now. Lorenzo may move this when he returns.

Hi Bjorn,

I could not find pci/host-tegra in your public repo, have you deleted it in the meanwhile ?

Welcome back, Lorenzo! Sorry, I forgot to push the pci/host-tegra branch. It has been in -next for a while, though. I pushed it now. Happy to drop the branch if you want to add more Tegra stuff, just let me know.

Bjorn

#7 lore raw

Re: [PATCH v2] PCI: tegra: Fix return value check of pm_runtime_get_sync

Quoted 19 lines · Bjorn Helgaas
Quoted 18 lines · Lorenzo Pieralisi
Quoted 6 lines · Bjorn Helgaas
Quoted 5 lines · David Engraf

pm_runtime_get_sync() returns the device's usage counter. This might be >0 if the device is already powered up or CONFIG_PM is disabled.

Abort probe function on real error only.

Quoted 8 lines
Quoted 2 lines
Fixes da76ba50963b ("PCI: tegra: Add power management support")

I added Andrew's ack and a stable tag for v4.17+. Also cc'd Manikanta, author of da76ba50963b.

I put this on my pci/host-tegra branch for v5.6 for now. Lorenzo may move this when he returns.

Hi Bjorn,

Quoted 7 lines
Quoted 2 lines

I could not find pci/host-tegra in your public repo, have you deleted it in the meanwhile ?

Welcome back, Lorenzo! Sorry, I forgot to push the pci/host-tegra branch. It has been in -next for a while, though. I pushed it now. Happy to drop the branch if you want to add more Tegra stuff, just let me know.

Thank you, I will have to add at least another tegra patch so I think it is best to drop your branch, I applied this patch to my pci/tegra branch and pushed it out in the meanwhile.

Thanks,
Lorenzo