[PATCH 02/16] of: Fix invalid path for of_find_node_by_path

Sascha Hauer s.hauer at pengutronix.de
Fri Jan 11 08:24:22 EST 2013


When of_find_node_by_path is called with a non existing path we
return just some node. return NULL instead.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/of/base.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 7a41618..399adc8 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -487,9 +487,10 @@ struct device_node *of_find_node_by_path(const char *path)
 
 	list_for_each_entry(np, &allnodes, list) {
 		if (np->full_name && (strcmp(np->full_name, path) == 0))
-			break;
+			return np;
 	}
-	return np;
+
+	return NULL;
 }
 EXPORT_SYMBOL(of_find_node_by_path);
 
-- 
1.7.10.4




More information about the barebox mailing list