summaryrefslogtreecommitdiff
path: root/drivers/gpio
diff options
context:
space:
mode:
authorDavid Laight <david.laight.linux@gmail.com>2025-11-19 22:41:14 +0000
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>2025-11-20 09:08:27 +0100
commitb2a186cced1199bb2777e229dc37a04d33507c6d (patch)
tree3a1168cfb05c9f41f8913f7641ef5b5da4972fc5 /drivers/gpio
parent3a8660878839faadb4f1a6dd72c3179c1df56787 (diff)
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>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpiolib-acpi-core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpio/gpiolib-acpi-core.c b/drivers/gpio/gpiolib-acpi-core.c
index 284e762d92c4..bcb8324d617d 100644
--- a/drivers/gpio/gpiolib-acpi-core.c
+++ b/drivers/gpio/gpiolib-acpi-core.c
@@ -1096,7 +1096,7 @@ acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address,
return AE_BAD_PARAMETER;
}
- length = min_t(u16, agpio->pin_table_length, pin_index + bits);
+ length = min(agpio->pin_table_length, pin_index + bits);
for (i = pin_index; i < length; ++i) {
unsigned int pin = agpio->pin_table[i];
struct acpi_gpio_connection *conn;