summaryrefslogtreecommitdiff
path: root/drivers/core/ofnode.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/core/ofnode.c')
-rw-r--r--drivers/core/ofnode.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index 0685b689d8..c6ca13fabf 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -390,10 +390,11 @@ int ofnode_decode_display_timing(ofnode parent, int index,
if (!ofnode_valid(timings))
return -EINVAL;
- for (i = 0, node = ofnode_first_subnode(timings);
- ofnode_valid(node) && i != index;
- node = ofnode_first_subnode(node))
- i++;
+ i = 0;
+ ofnode_for_each_subnode(node, timings) {
+ if (i++ == index)
+ break;
+ }
if (!ofnode_valid(node))
return -EINVAL;