Skip to content

Commit b2a186c

Browse files
David Laightandy-shev
authored andcommitted
gpiolib: acpi: use min() instead of min_t()
min_t(u16, a, b) casts an 'unsigned long' to 'u16'. Use min(a, b) instead as it promotes the both values to int and so cannot discard significant bits. In this case the values should be ok. Detected by an extra check added to min_t(). Signed-off-by: David Laight <david.laight.linux@gmail.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
1 parent 3a86608 commit b2a186c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/gpio/gpiolib-acpi-core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1096,7 +1096,7 @@ acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address,
10961096
return AE_BAD_PARAMETER;
10971097
}
10981098

1099-
length = min_t(u16, agpio->pin_table_length, pin_index + bits);
1099+
length = min(agpio->pin_table_length, pin_index + bits);
11001100
for (i = pin_index; i < length; ++i) {
11011101
unsigned int pin = agpio->pin_table[i];
11021102
struct acpi_gpio_connection *conn;

0 commit comments

Comments
 (0)