Commit 1344db83 authored by Sakari Ailus's avatar Sakari Ailus Committed by Greg Kroah-Hartman

ACPI: device property: Fix node lookup in acpi_graph_get_child_prop_value()

commit b5212f57 upstream.

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: 79389a83 (ACPI / property: Add support for remote endpoints)
Reported-by: default avatarHyungwoo Yang <hyungwoo.yang@intel.com>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
[ rjw: Changelog ]
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent dbe5b2d7
......@@ -1046,7 +1046,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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment