diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2017-11-17 20:30:44 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2017-11-17 20:30:44 +0000 |
commit | 3013c5dbc5c9751d8d571d521bd879b87ea7deb2 (patch) | |
tree | e0e699d60dd409dc76936391a415cca4b57cde1c | |
parent | 9a2e95a9ac756b15444b5dab4fa46b63beba2f04 (diff) |
Make OF_getnodebyname() scan its child nodes instead of its peer nodes.
This still deviates from the implementation we have on macppc, but we only
ever use OF_getnodebyname() to find child nodes in our tree.
ok tom@, visa@
-rw-r--r-- | sys/dev/ofw/fdt.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/sys/dev/ofw/fdt.c b/sys/dev/ofw/fdt.c index d6a64499e88..82ef499d921 100644 --- a/sys/dev/ofw/fdt.c +++ b/sys/dev/ofw/fdt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fdt.c,v 1.20 2017/03/12 11:44:42 kettenis Exp $ */ +/* $OpenBSD: fdt.c,v 1.21 2017/11/17 20:30:43 kettenis Exp $ */ /* * Copyright (c) 2009 Dariusz Swiderski <sfires@sfires.net> @@ -773,11 +773,9 @@ OF_getnodebyname(int handle, const char *name) 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; |