]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
gpio: fix aspeed_gpio_banks array size check
authorVasyl Gomonovych <gomonovych@gmail.com>
Thu, 21 Dec 2017 15:55:10 +0000 (16:55 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Thu, 28 Dec 2017 12:53:06 +0000 (13:53 +0100)
The test should be >= ARRAY_SIZE() instead of > ARRAY_SIZE().

Signed-off-by: Vasyl Gomonovych <gomonovych@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-aspeed.c

index 30bc97b81bec2d516215f8725292f62f162835ff..77e485557498329193fd291194cc037de55c8160 100644 (file)
@@ -149,7 +149,7 @@ static const struct aspeed_gpio_bank *to_bank(unsigned int offset)
 {
        unsigned int bank = GPIO_BANK(offset);
 
-       WARN_ON(bank > ARRAY_SIZE(aspeed_gpio_banks));
+       WARN_ON(bank >= ARRAY_SIZE(aspeed_gpio_banks));
        return &aspeed_gpio_banks[bank];
 }