Skip to contentSkip to conversation

soc: fsl: guts: fix IS_ERR() vs NULL bug

PATCH In review Dan Carpenter 2 participants 2 messages Jul 4, 2022

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

PATCH 1/1 soc: fsl: guts: fix IS_ERR() vs NULL bug

The of_iomap() function returns NULL on failure, it never returns error pointers.

Fixes ab4988d6a393 ("soc: fsl: guts: embed fsl_guts_get_svr() in probe()")
---
 drivers/soc/fsl/guts.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/soc/fsl/guts.c +2 -2
index 27035de062f8..8038c599ad83 100644
@@ -195,9 +195,9 @@ static int __init fsl_guts_init(void)
 	soc_data = match->data;
 
 	regs = of_iomap(np, 0);
-	if (IS_ERR(regs)) {
+	if (!regs) {
 		of_node_put(np);
-		return PTR_ERR(regs);
+		return -ENOMEM;
 	}
 
 	little_endian = of_property_read_bool(np, "little-endian");
Signature · 1 line
2.35.1
#1 lore raw

Am 2022-07-04 12:55, schrieb Dan Carpenter:

Quoted 15 lines

The of_iomap() function returns NULL on failure, it never returns error pointers.

Fixes ab4988d6a393 ("soc: fsl: guts: embed fsl_guts_get_svr() in probe()")
---
 drivers/soc/fsl/guts.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/soc/fsl/guts.c +0 -0
index 27035de062f8..8038c599ad83 100644
@@ -195,9 +195,9 @@ static int __init fsl_guts_init(void)
 	soc_data = match->data;

drivers/soc/fsl/guts.c static int __init fsl_guts_init(void) · line 203

Quoted 10 lines
drivers/soc/fsl/guts.c +2 -2
 
 	regs = of_iomap(np, 0);
-	if (IS_ERR(regs)) {
+	if (!regs) {
 		of_node_put(np);
-		return PTR_ERR(regs);
+		return -ENOMEM;
 	}
 
 	little_endian = of_property_read_bool(np, "little-endian");

There was already a patch for this:
https://lore.kernel.org/lkml/[email protected]/

-michael