Skip to contentSkip to conversation

clk: sp7021: fix return value check in sp7021_clk_probe()

PATCH Applied Yang Yingliang 2 participants 2 messages Nov 28, 2023 – Dec 17, 2023

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

PATCH 1/1 clk: sp7021: fix return value check in sp7021_clk_probe()

devm_platform_ioremap_resource() never returns NULL pointer, it will return ERR_PTR() when it fails, so replace the check with IS_ERR().

Fixes d54c1fd4a51e ("clk: Add Sunplus SP7021 clock driver")
---
 drivers/clk/clk-sp7021.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/clk/clk-sp7021.c +6 -6
index 01d3c4c7b0b2..7cb7d501d7a6 100644
@@ -604,14 +604,14 @@ static int sp7021_clk_probe(struct platform_device *pdev)
 	int i;
 
 	clk_base = devm_platform_ioremap_resource(pdev, 0);
-	if (!clk_base)
-		return -ENXIO;
+	if (IS_ERR(clk_base))
+		return PTR_ERR(clk_base);
 	pll_base = devm_platform_ioremap_resource(pdev, 1);
-	if (!pll_base)
-		return -ENXIO;
+	if (IS_ERR(pll_base))
+		return PTR_ERR(pll_base);
 	sys_base = devm_platform_ioremap_resource(pdev, 2);
-	if (!sys_base)
-		return -ENXIO;
+	if (IS_ERR(sys_base))
+		return PTR_ERR(sys_base);
 
 	/* enable default clks */
 	for (i = 0; i < ARRAY_SIZE(sp_clken); i++)
Signature · 1 line
2.25.1
maintainer Applied
#1 lore raw

Quoting Yang Yingliang (2023-11-28 05:30:16)

Quoted 7 lines

devm_platform_ioremap_resource() never returns NULL pointer, it will return ERR_PTR() when it fails, so replace the check with IS_ERR().

Fixes d54c1fd4a51e ("clk: Add Sunplus SP7021 clock driver")

---

Applied to clk-next