* [PATCH] ACPI: property: Fix mis-use of _Generic()
@ 2022-08-12 11:33 Zenghui Yu
0 siblings, 0 replies; only message in thread
From: Zenghui Yu @ 2022-08-12 11:33 UTC (permalink / raw)
To: linux-acpi, linux-kernel
Cc: rafael, lenb, wanghaibin.wang, Zenghui Yu, Sakari Ailus
It looks wrong to pass __val as the control-expression of _Generic() which
will always return 0U this way and acpi_copy_property_array_uint() is
likely to return -EOVERFLOW error whilst it actually doesn't.
Use __val[i] to match the given type list.
Fixes: 923044133367 ("ACPI: property: Unify integer value reading functions")
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Zenghui Yu <yuzenghui@huawei.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 7b3ad8ed2f4e..1ededa618a88 100644
--- a/drivers/acpi/property.c
+++ b/drivers/acpi/property.c
@@ -1042,7 +1042,7 @@ static int acpi_data_prop_read_single(const struct acpi_device_data *data,
ret = -EPROTO; \
break; \
} \
- if (__items[i].integer.value > _Generic(__val, \
+ if (__items[i].integer.value > _Generic(__val[i], \
u8: U8_MAX, \
u16: U16_MAX, \
u32: U32_MAX, \
--
2.33.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-08-12 11:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-12 11:33 [PATCH] ACPI: property: Fix mis-use of _Generic() Zenghui Yu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.