Linux ACPI
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Linux ACPI <linux-acpi@vger.kernel.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Zhang Rui <rui.zhang@intel.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>
Subject: [PATCH v1 1/2] ACPI: sysfs: Fix acpi_object_path() return value
Date: Fri, 04 Dec 2026 17:18:22 +0100	[thread overview]
Message-ID: <3078664.e9J7NaK4W3@rafael.j.wysocki> (raw)
In-Reply-To: <2290486.irdbgypaU6@rafael.j.wysocki>

From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>

Since acpi_get_name() returns an acpi_status which is a positive
number on failure, its return value should not be returned to the
caller by acpi_object_path().

Make acpi_object_path() return -ENODATA if acpi_get_name() fails.

Fixes: e49bd2dd5a50 ("ACPI: use PNPID:instance_no as bus_id of ACPI device")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/device_sysfs.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

--- a/drivers/acpi/device_sysfs.c
+++ b/drivers/acpi/device_sysfs.c
@@ -23,9 +23,8 @@ static ssize_t acpi_object_path(acpi_han
 	struct acpi_buffer path = {ACPI_ALLOCATE_BUFFER, NULL};
 	int result;
 
-	result = acpi_get_name(handle, ACPI_FULL_PATHNAME, &path);
-	if (result)
-		return result;
+	if (ACPI_FAILURE(acpi_get_name(handle, ACPI_FULL_PATHNAME, &path)))
+		return -ENODATA;
 
 	result = sysfs_emit(buf, "%s\n", (char *)path.pointer);
 	kfree(path.pointer);




  reply	other threads:[~2026-12-04 16:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 16:17 [PATCH v1 0/2] ACPI: sysfs/utils: Fix and simplification related to object paths Rafael J. Wysocki
2026-12-04 16:18 ` Rafael J. Wysocki [this message]
2026-12-04 17:37   ` [PATCH v1 1/2] ACPI: sysfs: Fix acpi_object_path() return value Andy Shevchenko
2026-12-04 16:20 ` [PATCH v1 2/2] ACPI: utils: Add acpi_path_free and adjust acpi_handle_path() Rafael J. Wysocki
2026-12-04 17:40   ` Andy Shevchenko
2026-12-04 18:03     ` Rafael J. Wysocki (Intel)
2026-12-04 17:41 ` [PATCH v1 0/2] ACPI: sysfs/utils: Fix and simplification related to object paths Andy Shevchenko

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=3078664.e9J7NaK4W3@rafael.j.wysocki \
    --to=rafael@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=sakari.ailus@linux.intel.com \
    /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