gpio: ep93xx: fix test for end of loop

The problem is that if port == ARRAY_SIZE() and "gc == &epg->gc[port]"
then that should be treated as invalid.

Fixes: fd935fc421 ("gpio: ep93xx: Do not pingpong irq numbers")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
Dan Carpenter 2018-09-06 16:33:48 +03:00 committed by Linus Walleij
parent f40f73075c
commit f6d9af4770

View File

@ -80,7 +80,7 @@ static int ep93xx_gpio_port(struct gpio_chip *gc)
port++;
/* This should not happen but is there as a last safeguard */
if (gc != &epg->gc[port]) {
if (port == ARRAY_SIZE(epg->gc)) {
pr_crit("can't find the GPIO port\n");
return 0;
}