* [PATCH] OF: base: fix iterator in of_get_next_available_child
@ 2013-07-03 23:18 Sebastian Hesselbarth
0 siblings, 0 replies; only message in thread
From: Sebastian Hesselbarth @ 2013-07-03 23:18 UTC (permalink / raw)
To: Sebastian Hesselbarth; +Cc: barebox
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 <sebastian.hesselbarth@gmail.com>
---
Note: This should be the last iterator fix required. I have tested all
for_each_ helpers. Thanks for Hiroki for reporting this and the initial
quick fix.
Unfortunately, I found this one after I sent the patch set.
Cc: barebox@lists.infradead.org
Cc: Hiroki Nishimoto <hiroki.nishimoto.if@gmail.com>
---
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 0500c86..8c6dbcf 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1352,7 +1352,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;
--
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:[~2013-07-03 23:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-03 23:18 [PATCH] OF: base: fix iterator in of_get_next_available_child Sebastian Hesselbarth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox