* [PATCH] PCI: dwc: kirin: Use PTR_ERR_OR_ZERO
@ 2020-11-16 16:44 Sudip Mukherjee
0 siblings, 0 replies; only message in thread
From: Sudip Mukherjee @ 2020-11-16 16:44 UTC (permalink / raw)
To: Xiaowei Song, Binghui Wang, Lorenzo Pieralisi, Rob Herring,
Bjorn Helgaas
Cc: linux-kernel, linux-safety, 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/dwc/pcie-kirin.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/pci/controller/dwc/pcie-kirin.c b/drivers/pci/controller/dwc/pcie-kirin.c
index d0a6a2dee6f5..cf1379a8b950 100644
--- a/drivers/pci/controller/dwc/pcie-kirin.c
+++ b/drivers/pci/controller/dwc/pcie-kirin.c
@@ -138,10 +138,8 @@ static long kirin_pcie_get_clk(struct kirin_pcie *kirin_pcie,
return PTR_ERR(kirin_pcie->apb_sys_clk);
kirin_pcie->pcie_aclk = devm_clk_get(dev, "pcie_aclk");
- if (IS_ERR(kirin_pcie->pcie_aclk))
- return PTR_ERR(kirin_pcie->pcie_aclk);
- return 0;
+ return PTR_ERR_OR_ZERO(kirin_pcie->pcie_aclk);
}
static long kirin_pcie_get_resource(struct kirin_pcie *kirin_pcie,
@@ -169,10 +167,8 @@ static long kirin_pcie_get_resource(struct kirin_pcie *kirin_pcie,
kirin_pcie->sysctrl =
syscon_regmap_lookup_by_compatible("hisilicon,hi3660-sctrl");
- if (IS_ERR(kirin_pcie->sysctrl))
- return PTR_ERR(kirin_pcie->sysctrl);
- return 0;
+ return PTR_ERR_OR_ZERO(kirin_pcie->sysctrl);
}
static int kirin_pcie_phy_init(struct kirin_pcie *kirin_pcie)
--
2.11.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2020-11-16 16:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-16 16:44 [PATCH] PCI: dwc: kirin: Use PTR_ERR_OR_ZERO Sudip Mukherjee
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).