Skip to contentSkip to conversation

soc: ixp4xx: npe: Fix an IS_ERR() vs NULL check in probe

PATCH In review Dan Carpenter 3 participants 4 messages Jun 13, 2019 – Jun 18, 2019

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

PATCH 1/1 soc: ixp4xx: npe: Fix an IS_ERR() vs NULL check in probe

The devm_ioremap_resource() function doesn't return NULL, it returns error pointers.

Fixes 0b458d7b10f8 ("soc: ixp4xx: npe: Pass addresses as resources")
---
 drivers/soc/ixp4xx/ixp4xx-npe.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/soc/ixp4xx/ixp4xx-npe.c +2 -2
index bc10e3194809..ec90b44fa0cd 100644
@@ -695,8 +695,8 @@ static int ixp4xx_npe_probe(struct platform_device *pdev)
 			continue; /* NPE already disabled or not present */
 		}
 		npe->regs = devm_ioremap_resource(dev, res);
-		if (!npe->regs)
-			return -ENOMEM;
+		if (IS_ERR(npe->regs))
+			return PTR_ERR(npe->regs);
 
 		if (npe_reset(npe)) {
 			dev_info(dev, "NPE%d at 0x%08x-0x%08x does not reset\n",
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Dan Carpenter

The devm_ioremap_resource() function doesn't return NULL, it returns error pointers.

Fixes 0b458d7b10f8 ("soc: ixp4xx: npe: Pass addresses as resources")

Can you please collect my review and send this to the ARM SoC maintainers [email protected] since they are collecting a few other IXP4xx fixes?

Yours,
Linus Walleij

#2 lore raw

PATCH 1/1 soc: ixp4xx: npe: Fix an IS_ERR() vs NULL check in probe

The devm_ioremap_resource() function doesn't return NULL, it returns error pointers.

Fixes 0b458d7b10f8 ("soc: ixp4xx: npe: Pass addresses as resources")
---
 drivers/soc/ixp4xx/ixp4xx-npe.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/soc/ixp4xx/ixp4xx-npe.c +2 -2
index bc10e3194809..ec90b44fa0cd 100644
@@ -695,8 +695,8 @@ static int ixp4xx_npe_probe(struct platform_device *pdev)
 			continue; /* NPE already disabled or not present */
 		}
 		npe->regs = devm_ioremap_resource(dev, res);
-		if (!npe->regs)
-			return -ENOMEM;
+		if (IS_ERR(npe->regs))
+			return PTR_ERR(npe->regs);
 
 		if (npe_reset(npe)) {
 			dev_info(dev, "NPE%d at 0x%08x-0x%08x does not reset\n",
Signature · 1 line
2.20.1