From: Sakari Ailus Date: Tue, 22 Aug 2017 20:39:58 +0000 (+0300) Subject: ACPI: device property: Fix node lookup in acpi_graph_get_child_prop_value() X-Git-Tag: v4.12.10~39 X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1344db83ee17ca11be551ed074a64a28d8e17f1e;p=linux 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 Signed-off-by: Sakari Ailus [ rjw: Changelog ] Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c index 9364398204e9..6822ac9f106b 100644 --- a/drivers/acpi/property.c +++ b/drivers/acpi/property.c @@ -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)