[PATCH] of: Check for NULL pointer in of_find_property

Sascha Hauer s.hauer at pengutronix.de
Thu Oct 25 11:56:40 EDT 2012


The console layer calls of_device_is_stdout_path for a new console. When
we are booting without devicetree then of_chosen is NULL which makes barebox
crash. Check for a NULL pointer in of_find_property to prevent this.

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

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 5853826..7a41618 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -106,6 +106,9 @@ struct property *of_find_property(const struct device_node *node, const char *na
 {
 	struct property *p;
 
+	if (!node)
+		return NULL;
+
 	list_for_each_entry(p, &node->properties, list)
 		if (!strcmp(p->name, name))
 			return p;
-- 
1.7.10.4




More information about the barebox mailing list