diff options
-rw-r--r-- | sys/dev/acpi/dsdt.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/dev/acpi/dsdt.c b/sys/dev/acpi/dsdt.c index cbd38c9be6f..68651c0bffd 100644 --- a/sys/dev/acpi/dsdt.c +++ b/sys/dev/acpi/dsdt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dsdt.c,v 1.245 2019/07/31 15:47:49 jcs Exp $ */ +/* $OpenBSD: dsdt.c,v 1.246 2019/07/31 15:58:00 jcs Exp $ */ /* * Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org> * @@ -1263,6 +1263,7 @@ aml_find_node(struct aml_node *node, const char *name, struct aml_node *child; const char *nn; + /* match child of this node first before recursing */ SIMPLEQ_FOREACH(child, &node->son, sib) { nn = child->name; if (nn != NULL) { @@ -1270,12 +1271,14 @@ aml_find_node(struct aml_node *node, const char *name, while (*nn == AMLOP_PARENTPREFIX) nn++; if (strcmp(name, nn) == 0) { /* Only recurse if cbproc() wants us to */ - if (cbproc(child, arg) == 0) - continue; + if (cbproc(child, arg) != 0) + return; } } - aml_find_node(child, name, cbproc, arg); } + + SIMPLEQ_FOREACH(child, &node->son, sib) + aml_find_node(child, name, cbproc, arg); } /* |