gpio: nomadik: remove BUG_ON() in nmk_gpio_populate_chip()
authorDan Carpenter <dan.carpenter@linaro.org>
Mon, 11 Mar 2024 11:00:53 +0000 (14:00 +0300)
committerLinus Walleij <linus.walleij@linaro.org>
Tue, 12 Mar 2024 11:53:33 +0000 (12:53 +0100)
commit289b950b8e50d2e23120081d110f3f6fae5c085f
treee0079e2a3a985d6339650cc5e8a184b6bf610138
parentc056ccff5ec5751dd7da97bbed8efb920c778206
gpio: nomadik: remove BUG_ON() in nmk_gpio_populate_chip()

Using BUG_ON() is discouraged and also the check wasn't done early
enough to prevent an out of bounds access.  Check earlier and return
an error instead of calling BUG().

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/ae643df0-3a3e-4270-8dbf-be390ee4b478@moroto.mountain
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-nomadik.c