From f457f683cb5482e8687c55689864e80ca49e372c Mon Sep 17 00:00:00 2001 From: Sebastian Hesselbarth Date: Thu, 4 Jul 2013 01:18:41 +0200 Subject: [PATCH] OF: base: fix iterator in of_get_next_available_child of_get_next_available_child does not iterate but always tries the same node over and over again. This first prepares the entry and then uses list_for_each_entry_continue, instead of for_each_child_of_node before. Signed-off-by: Sebastian Hesselbarth Signed-off-by: Sascha Hauer --- drivers/of/base.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index 74d474837..07b8cd74d 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1380,7 +1380,8 @@ EXPORT_SYMBOL(of_get_parent); struct device_node *of_get_next_available_child(const struct device_node *node, struct device_node *prev) { - for_each_child_of_node(node, prev) + prev = list_prepare_entry(prev, &node->children, parent_list); + list_for_each_entry_continue(prev, &node->children, parent_list) if (of_device_is_available(prev)) return prev; return NULL;