2017-12-21 15:55:24

by Vasyl Gomonovych

[permalink] [raw]
Subject: [PATCH] gpio: fix aspeed_gpio_banks array size check

The test should be >= ARRAY_SIZE() instead of > ARRAY_SIZE().

Signed-off-by: Vasyl Gomonovych <[email protected]>
---
drivers/gpio/gpio-aspeed.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

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];
}

--
1.9.1


2017-12-28 12:53:30

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH] gpio: fix aspeed_gpio_banks array size check

On Thu, Dec 21, 2017 at 4:55 PM, Vasyl Gomonovych <[email protected]> wrote:

> The test should be >= ARRAY_SIZE() instead of > ARRAY_SIZE().
>
> Signed-off-by: Vasyl Gomonovych <[email protected]>

Patch applied.

Yours,
Linus Walleij