]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ACPI: property: Fix return value for nval == 0 in acpi_data_prop_read()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 3 Feb 2025 19:46:29 +0000 (21:46 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Feb 2025 12:49:37 +0000 (13:49 +0100)
commit7998880cb4b2d5595a147442baa80127572ff836
tree36cc828182994491932ce8b2fcd664608d43d9a7
parent64934b8b8efde236901e04437150b9989892bbd4
ACPI: property: Fix return value for nval == 0 in acpi_data_prop_read()

[ Upstream commit ab930483eca9f3e816c35824b5868599af0c61d7 ]

While analysing code for software and OF node for the corner case when
caller asks to read zero items in the supposed to be an array of values
I found that ACPI behaves differently to what OF does, i.e.

 1. It returns -EINVAL when caller asks to read zero items from integer
    array, while OF returns 0, if no other errors happened.

 2. It returns -EINVAL when caller asks to read zero items from string
    array, while OF returns -ENODATA, if no other errors happened.

Amend ACPI implementation to follow what OF does.

Fixes: b31384fa5de3 ("Driver core: Unified device properties interface for platform firmware")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250203194629.3731895-1-andriy.shevchenko@linux.intel.com
[ rjw: Added empty line after a conditional ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/acpi/property.c