The > WPCM450_NUM_BANKS should be >= or it leads to an out of bounds
access on the next line.
Fixes:
a1d1e0e3d80a ("pinctrl: nuvoton: Add driver for WPCM450")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Link: https://lore.kernel.org/r/20220318071131.GA29472@kili
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
gpio = &pctrl->gpio_bank[reg];
gpio->pctrl = pctrl;
- if (reg > WPCM450_NUM_BANKS)
+ if (reg >= WPCM450_NUM_BANKS)
return dev_err_probe(dev, -EINVAL,
"GPIO index %d out of range!\n", reg);