[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20201116164403.25289-1-sudipm.mukherjee@gmail.com>
Date: Mon, 16 Nov 2020 16:44:03 +0000
From: Sudip Mukherjee <sudipm.mukherjee@...il.com>
To: Xiaowei Song <songxiaowei@...ilicon.com>,
Binghui Wang <wangbinghui@...ilicon.com>,
Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
Rob Herring <robh@...nel.org>,
Bjorn Helgaas <bhelgaas@...gle.com>
Cc: linux-kernel@...r.kernel.org, linux-safety@...ts.elisa.tech,
linux-pci@...r.kernel.org,
Sudip Mukherjee <sudipm.mukherjee@...il.com>
Subject: [PATCH] PCI: dwc: kirin: 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'.
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@...il.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
Powered by blists - more mailing lists