[RFT PATCH v2 01/14] gpio: regmap: use the correct number for .ngpio_per_reg
Michael Walle
mwalle at kernel.org
Fri Nov 27 06:52:18 PST 2026
Setting .ngpio_per_reg to 0 means that gpio-regmap assumes there is only
one register. If the number of GPIOs comes from gpiochip_get_ngpios()
config->ngpio is still 0 and it's taking over the wrong number.
Fix it by using chip->ngpio, which uses either config->ngpio or
gpiochip_get_ngpios().
Reported-by: Sashiko <sashiko-bot at kernel.org>
Closes: https://sashiko.dev/#/bug/linux-85577bd9-c441-47ec-b415-cd40acf50e01
Fixes: db305161880a ("gpio: regmap: Allow ngpio to be read from the property")
Signed-off-by: Michael Walle <mwalle at kernel.org>
---
drivers/gpio/gpio-regmap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c
index ac6ad56f4479..65e87177baf0 100644
--- a/drivers/gpio/gpio-regmap.c
+++ b/drivers/gpio/gpio-regmap.c
@@ -523,7 +523,7 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config
/* if not set, assume there is only one register */
gpio->ngpio_per_reg = config->ngpio_per_reg;
if (!gpio->ngpio_per_reg)
- gpio->ngpio_per_reg = config->ngpio;
+ gpio->ngpio_per_reg = chip->ngpio;
/* if not set, assume they are consecutive */
gpio->reg_stride = config->reg_stride;
--
2.47.3
More information about the linux-arm-kernel
mailing list