Skip to contentSkip to conversation

phy: Sparx5 Eth SerDes: Fix return value check in sparx5_serdes_probe()

PATCH Applied Yang Yingliang 2 participants 2 messages Sep 9, 2021 – Oct 25, 2021

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

PATCH 1/1 phy: Sparx5 Eth SerDes: Fix return value check in sparx5_serdes_probe()

In case of error, the function devm_ioremap() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test.

Fixes 2ff8a1eeb5aa ("phy: Add Sparx5 ethernet serdes PHY driver")
---
 drivers/phy/microchip/sparx5_serdes.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/phy/microchip/sparx5_serdes.c +2 -2
index 4076580fc2cd..ab1b0986aa67 100644
@@ -2475,10 +2475,10 @@ static int sparx5_serdes_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 	iomem = devm_ioremap(priv->dev, iores->start, resource_size(iores));
-	if (IS_ERR(iomem)) {
+	if (!iomem) {
 		dev_err(priv->dev, "Unable to get serdes registers: %s\n",
 			iores->name);
-		return PTR_ERR(iomem);
+		return -ENOMEM;
 	}
 	for (idx = 0; idx < ARRAY_SIZE(sparx5_serdes_iomap); idx++) {
 		struct sparx5_serdes_io_resource *iomap = &sparx5_serdes_iomap[idx];
Signature · 1 line
2.25.1
maintainer Applied
#1 lore raw
Quoted 3 lines · Yang Yingliang

In case of error, the function devm_ioremap() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test.

Applied, thanks

Signature · 1 line
~Vinod