The idea is that it will look for children of the passed node with a
specific name.  But it doesn't actually work because it looks for
nodes at the same level of the passed node.  This diff fixes it.

ok?


Index: dev/ofw/fdt.c
===================================================================
RCS file: /cvs/src/sys/dev/ofw/fdt.c,v
retrieving revision 1.20
diff -u -p -r1.20 fdt.c
--- dev/ofw/fdt.c       12 Mar 2017 11:44:42 -0000      1.20
+++ dev/ofw/fdt.c       28 Aug 2017 20:39:47 -0000
@@ -773,11 +773,9 @@ OF_getnodebyname(int handle, const char 
        if (handle == 0)
                node = fdt_find_node("/");
 
-       while (node) {
+       for (node = fdt_child_node(node); node; node = fdt_next_node(node)) {
                if (strcmp(name, fdt_node_name(node)) == 0)
                        break;
-
-               node = fdt_next_node(node);
        }
 
        return node ? ((char *)node - (char *)tree.header) : 0;

Reply via email to