Skip to contentSkip to conversation

bus: arm-integrator-lm: Fix an IS_ERR() vs NULL check

PATCH In review Dan Carpenter 2 participants 2 messages May 20, 2020 – May 25, 2020

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

PATCH 1/1 bus: arm-integrator-lm: Fix an IS_ERR() vs NULL check

The of_find_matching_node() function returns NULL on error, it never returns error pointers. This doesn't really impact runtime very much because if "syscon" is NULL then syscon_node_to_regmap() will return -EINVAL. The only runtime difference is that now it returns -ENODEV.

Fixes ccea5e8a5918 ("bus: Add driver for Integrator/AP logic modules")

---
The first patch which added this file doesn't give a good hint what the subsystem prefix should be so I just guessed "bus: arm-integrator-lm:".

 drivers/bus/arm-integrator-lm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/bus/arm-integrator-lm.c +2 -2
index 669ea7e1f92e..845b6c43fef8 100644
@@ -78,10 +78,10 @@ static int integrator_ap_lm_probe(struct platform_device *pdev)
 
 	/* Look up the system controller */
 	syscon = of_find_matching_node(NULL, integrator_ap_syscon_match);
-	if (IS_ERR(syscon)) {
+	if (!syscon) {
 		dev_err(dev,
 			"could not find Integrator/AP system controller\n");
-		return PTR_ERR(syscon);
+		return -ENODEV;
 	}
 	map = syscon_node_to_regmap(syscon);
 	if (IS_ERR(map)) {
Signature · 1 line
2.26.2
#1 lore raw

Hi Dan,

Quoted 10 lines · Dan Carpenter

The of_find_matching_node() function returns NULL on error, it never returns error pointers. This doesn't really impact runtime very much because if "syscon" is NULL then syscon_node_to_regmap() will return -EINVAL. The only runtime difference is that now it returns -ENODEV.

Fixes ccea5e8a5918 ("bus: Add driver for Integrator/AP logic modules")

---
The first patch which added this file doesn't give a good hint what the subsystem prefix should be so I just guessed "bus: arm-integrator-lm:".

I got a similar patch from Wei that I forwarded to the ARM SoC maintainers that usually apply the bus patches for me.

Thanks anyway!

Yours,
Linus Walleij