public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: linux-acpi@vger.kernel.org
Cc: hyungwoo.yang@intel.com, mika.westerberg@intel.com, rafael@kernel.org
Subject: [PATCH 1/1] ACPI: device property: Fix node lookup in acpi_graph_get_child_prop_value
Date: Tue, 22 Aug 2017 10:01:17 +0300	[thread overview]
Message-ID: <1503385277-1944-1-git-send-email-sakari.ailus@linux.intel.com> (raw)

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.

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>
---
 drivers/acpi/property.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
index a65c09c..3963098 100644
--- a/drivers/acpi/property.c
+++ b/drivers/acpi/property.c
@@ -1052,7 +1052,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(fwnode, prop_name, &nr))
 			continue;
 
 		if (val == nr)
-- 
2.7.4


             reply	other threads:[~2017-08-22  7:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-22  7:01 Sakari Ailus [this message]
2017-08-22 17:47 ` [PATCH 1/1] ACPI: device property: Fix node lookup in acpi_graph_get_child_prop_value Yang, Hyungwoo
2017-08-22 20:41   ` Sakari Ailus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1503385277-1944-1-git-send-email-sakari.ailus@linux.intel.com \
    --to=sakari.ailus@linux.intel.com \
    --cc=hyungwoo.yang@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=mika.westerberg@intel.com \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox