Skip to contentSkip to conversation

PCI: tegra: Use PTR_ERR_OR_ZERO

PATCH In review Sudip Mukherjee 4 participants 4 messages Nov 16, 2020 – Nov 23, 2020

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

PATCH 1/1 PCI: tegra: Use PTR_ERR_OR_ZERO

Coccinelle suggested using PTR_ERR_OR_ZERO() and looking at the code, we can use PTR_ERR_OR_ZERO() instead of checking IS_ERR() and then doing 'return 0'.

---
 drivers/pci/controller/pci-tegra.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pci/controller/pci-tegra.c +1 -3
index 8fcabed7c6a6..4c52b2d58645 100644
@@ -1308,10 +1308,8 @@ static int tegra_pcie_resets_get(struct tegra_pcie *pcie)
 		return PTR_ERR(pcie->afi_rst);
 
 	pcie->pcie_xrst = devm_reset_control_get_exclusive(dev, "pcie_x");
-	if (IS_ERR(pcie->pcie_xrst))
-		return PTR_ERR(pcie->pcie_xrst);
 
-	return 0;
+	return PTR_ERR_OR_ZERO(pcie->pcie_xrst);
 }
 
 static int tegra_pcie_phys_get_legacy(struct tegra_pcie *pcie)
Signature · 11 lines
2.11.0



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#170): https://lists.elisa.tech/g/linux-safety/message/170
Mute This Topic: https://lists.elisa.tech/mt/78296400/5278000
Group Owner: [email protected]
Unsubscribe: https://lists.elisa.tech/g/linux-safety/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
#1 lore raw
Quoted 8 lines · Sudip Mukherjee

Coccinelle suggested using PTR_ERR_OR_ZERO() and looking at the code, we can use PTR_ERR_OR_ZERO() instead of checking IS_ERR() and then doing 'return 0'.

---
 drivers/pci/controller/pci-tegra.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

This has been proposed multiple times in the past and Bjorn and I have agreed every time that this is not an improvement, so sorry, but NAK.

Thierry

#2 lore raw
Quoted 5 lines · Thierry Reding
Quoted 4 lines · Sudip Mukherjee

Coccinelle suggested using PTR_ERR_OR_ZERO() and looking at the code, we can use PTR_ERR_OR_ZERO() instead of checking IS_ERR() and then doing 'return 0'.

Quoted 7 lines
Quoted 4 lines
---
 drivers/pci/controller/pci-tegra.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

This has been proposed multiple times in the past and Bjorn and I have agreed every time that this is not an improvement, so sorry, but NAK.

Thanks Thierry and Neil. I have now added a blacklist script in our CI so "PTR_ERR_OR_ZERO" will not be flagged for anything in drivers/pci/* anymore in our testing.

Signature · 2 lines
Regards
Sudip
#3 lore raw
Quoted 13 lines · Sudip Mukherjee
Quoted 10 lines · Thierry Reding
Quoted 8 lines · Sudip Mukherjee

Coccinelle suggested using PTR_ERR_OR_ZERO() and looking at the code, we can use PTR_ERR_OR_ZERO() instead of checking IS_ERR() and then doing 'return 0'.

---
 drivers/pci/controller/pci-tegra.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
Quoted 8 lines
Quoted 2 lines

This has been proposed multiple times in the past and Bjorn and I have agreed every time that this is not an improvement, so sorry, but NAK.

Thanks Thierry and Neil. I have now added a blacklist script in our CI so "PTR_ERR_OR_ZERO" will not be flagged for anything in drivers/pci/* anymore in our testing.

Thanks, Sudip. I think that is a good idea to minimize churn on subsystem maintainers from janitors.

We can continue to discuss how to share these settings on ignore-rule-X-on-subsystem-Y with other "analysis tool CI maintainers".

Lukas