Skip to contentSkip to conversation

ACPI: property: Fix mis-use of _Generic()

PATCH New Zenghui Yu 1 participant 1 message Aug 12, 2022 ACPI

lore
Share & tools
lore

Zenghui Yu

author
#0 lore raw

PATCH 1/1 ACPI: property: Fix mis-use of _Generic()

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 <[email protected]>
---
 drivers/acpi/property.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/property.c +1 -1
index 7b3ad8ed2f4e..1ededa618a88 100644
@@ -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, \
Signature · 1 line
2.33.0