of_find_node_with_property suffers from infinite looping, because it does not check for root node of the tree iterated over. This adds a check for parent pointer of last tested iterator entry, which is NULL for the root node. Also set from node to current root_node if NULL. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@xxxxxxxxx> --- Cc: barebox@xxxxxxxxxxxxxxxxxxx Cc: Hiroki Nishimoto <hiroki.nishimoto.if@xxxxxxxxx> --- drivers/of/base.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/of/base.c b/drivers/of/base.c index 25f2e96..0500c86 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -363,10 +363,16 @@ struct device_node *of_find_node_with_property(struct device_node *from, { struct device_node *np; + if (!from) + from = root_node; + of_tree_for_each_node(np, from) { struct property *pp = of_find_property(np, prop_name, NULL); if (pp) return np; + /* check for root node */ + if (!np->parent) + break; } return NULL; -- 1.7.10.4 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox