git: d9ed1dcc5c68 - main - acpi: Fix error code returned in acpi_bus_get_prop
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 24 Nov 2021 18:43:10 UTC
The branch main has been updated by mw:
URL: https://cgit.FreeBSD.org/src/commit/?id=d9ed1dcc5c6894e376e6e4ef6f2554dd056baf4e
commit d9ed1dcc5c6894e376e6e4ef6f2554dd056baf4e
Author: Bartlomiej Grzesik <bag@semihalf.com>
AuthorDate: 2021-11-22 14:05:57 +0000
Commit: Marcin Wojtas <mw@FreeBSD.org>
CommitDate: 2021-11-24 18:42:43 +0000
acpi: Fix error code returned in acpi_bus_get_prop
ACPI implementation of device_get_property would return "-1" when
property was found, but it's type wasn't supported.
This causes device_has_property to return false in that scenario, which
arguably could be considered as incorrect.
Fix that by returning "0" in that case.
Reviewed by: bz, mw
Tested by: mw
MFC after: 2 weeks
Obtained from: Semihalf
Differential Revision: https://reviews.freebsd.org/D33103
---
sys/dev/acpica/acpi.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index 5d2b895bbe88..9b728b84bd12 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -1849,9 +1849,10 @@ acpi_bus_get_prop(device_t bus, device_t child, const char *propname,
memcpy(propvalue, obj->Buffer.Pointer,
MIN(size, obj->Buffer.Length));
return (obj->Buffer.Length);
- }
- return (-1);
+ default:
+ return (0);
+ }
}
int