Skip to content

Commit

Permalink
ACPI: device property: Fix node lookup in acpi_graph_get_child_prop_v…
Browse files Browse the repository at this point in the history
…alue()

acpi_graph_get_child_prop_value() is intended to find a child node with a
certain property value pair. The check

	if (!fwnode_property_read_u32(fwnode, prop_name, &nr))
		continue;

is faulty: fwnode_property_read_u32() returns zero on success, not on
failure, leading to comparing values only if the searched property was not
found.

Moreover, the check is made against the parent device node instead of
the child one as it should be.

Fixes: 79389a8 (ACPI / property: Add support for remote endpoints)
Reported-by: Hyungwoo Yang <[email protected]>
Signed-off-by: Sakari Ailus <[email protected]>
Cc: 4.12+ <[email protected]> # 4.12+
[ rjw: Changelog ]
Signed-off-by: Rafael J. Wysocki <[email protected]>
  • Loading branch information
Sakari Ailus authored and rafaeljw committed Aug 22, 2017
1 parent 14ccee7 commit b5212f5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/acpi/property.c
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,7 @@ static struct fwnode_handle *acpi_graph_get_child_prop_value(
fwnode_for_each_child_node(fwnode, child) {
u32 nr;

if (!fwnode_property_read_u32(fwnode, prop_name, &nr))
if (fwnode_property_read_u32(child, prop_name, &nr))
continue;

if (val == nr)
Expand Down

0 comments on commit b5212f5

Please sign in to comment.