[PATCH] of: Check for NULL pointer in of_find_property

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox


[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux