ACPI: device property: Fix node lookup in acpi_graph_get_child_prop_value()
authorSakari Ailus <sakari.ailus@linux.intel.com>
Tue, 22 Aug 2017 20:39:58 +0000 (23:39 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Aug 2017 08:26:36 +0000 (10:26 +0200)
commit1344db83ee17ca11be551ed074a64a28d8e17f1e
tree6ac92c4a5f92601bccb8e67790e1ac99fc74566b
parentdbe5b2d70cfdc3e1df1ceb3f715c6ef7d17fc566
ACPI: device property: Fix node lookup in acpi_graph_get_child_prop_value()

commit b5212f57da145e53df790a7e211d94daac768bf8 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: 79389a83bc38 (ACPI / property: Add support for remote endpoints)
Reported-by: Hyungwoo Yang <hyungwoo.yang@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
[ rjw: Changelog ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/acpi/property.c