All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PCI: tegra: Use PTR_ERR_OR_ZERO
@ 2017-08-29 13:39 ` Himanshu Jha
  0 siblings, 0 replies; 11+ messages in thread
From: Himanshu Jha @ 2017-08-29 13:39 UTC (permalink / raw)
  To: thierry.reding-Re5JQEeQqe8AvxtiuMwx3w
  Cc: bhelgaas-hpIqsD4AKlfQT0dZR+AlfA,
	jonathanh-DDmLM1+adcrQT0dZR+AlfA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	linux-pci-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Himanshu Jha

Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Signed-off-by: Himanshu Jha <himanshujha199640-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/pci/host/pci-tegra.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
index 9c40da5..90cda5b 100644
--- a/drivers/pci/host/pci-tegra.c
+++ b/drivers/pci/host/pci-tegra.c
@@ -1156,10 +1156,7 @@ 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)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread
* [PATCH] PCI: tegra: Use PTR_ERR_OR_ZERO
@ 2020-11-16 16:54 Sudip Mukherjee
  2020-11-16 17:01 ` Thierry Reding
  0 siblings, 1 reply; 11+ messages in thread
From: Sudip Mukherjee @ 2020-11-16 16:54 UTC (permalink / raw)
  To: Thierry Reding, Lorenzo Pieralisi, Rob Herring, Bjorn Helgaas,
	Jonathan Hunter
  Cc: linux-kernel, linux-safety, linux-tegra, linux-pci, 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'.

Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
 drivers/pci/controller/pci-tegra.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/pci/controller/pci-tegra.c b/drivers/pci/controller/pci-tegra.c
index 8fcabed7c6a6..4c52b2d58645 100644
--- a/drivers/pci/controller/pci-tegra.c
+++ b/drivers/pci/controller/pci-tegra.c
@@ -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)
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-11-16 17:02 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-29 13:39 [PATCH] PCI: tegra: Use PTR_ERR_OR_ZERO Himanshu Jha
2017-08-29 13:39 ` Himanshu Jha
2017-08-29 13:55 ` Thierry Reding
2017-08-29 14:14   ` Himanshu Jha
2017-08-29 15:09     ` Thierry Reding
2017-08-29 15:09       ` Thierry Reding
2017-08-30 13:59   ` Bjorn Helgaas
2017-08-30 14:25     ` Thierry Reding
2017-08-30 16:26       ` Bjorn Helgaas
2020-11-16 16:54 Sudip Mukherjee
2020-11-16 17:01 ` Thierry Reding

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.