Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: fd935fc421e7 ("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>

authored by

Dan Carpenter and committed by
Linus Walleij
f6d9af47 f40f7307

+1 -1
+1 -1
drivers/gpio/gpio-ep93xx.c
··· 80 80 port++; 81 81 82 82 /* This should not happen but is there as a last safeguard */ 83 - if (gc != &epg->gc[port]) { 83 + if (port == ARRAY_SIZE(epg->gc)) { 84 84 pr_crit("can't find the GPIO port\n"); 85 85 return 0; 86 86 }