diff mbox series

gpio: fix aspeed_gpio_banks array size check

Message ID 1513871710-13765-1-git-send-email-gomonovych@gmail.com
State New
Headers show
Series gpio: fix aspeed_gpio_banks array size check | expand

Commit Message

Vasyl Gomonovych Dec. 21, 2017, 3:55 p.m. UTC
The test should be >= ARRAY_SIZE() instead of > ARRAY_SIZE().

Signed-off-by: Vasyl Gomonovych <gomonovych@gmail.com>
---
 drivers/gpio/gpio-aspeed.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Linus Walleij Dec. 28, 2017, 12:53 p.m. UTC | #1
On Thu, Dec 21, 2017 at 4:55 PM, Vasyl Gomonovych <gomonovych@gmail.com> wrote:

> The test should be >= ARRAY_SIZE() instead of > ARRAY_SIZE().
>
> Signed-off-by: Vasyl Gomonovych <gomonovych@gmail.com>

Patch applied.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c
index 6b3ca6601af2..aac532837b81 100644
--- a/drivers/gpio/gpio-aspeed.c
+++ b/drivers/gpio/gpio-aspeed.c
@@ -140,7 +140,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];
 }