mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] of: Check for NULL pointer in of_find_property
@ 2012-10-25 15:56 Sascha Hauer
  0 siblings, 0 replies; only message in thread
From: Sascha Hauer @ 2012-10-25 15:56 UTC (permalink / raw)
  To: barebox

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@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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-10-25 15:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-25 15:56 [PATCH] of: Check for NULL pointer in of_find_property Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox