gpiolib: Fix incorrect use of find_next_zero_bit()
authorJanusz Krzysztofik <jmkrzyszt@gmail.com>
Sat, 29 Sep 2018 12:20:22 +0000 (14:20 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 1 Oct 2018 09:35:37 +0000 (11:35 +0200)
commit799d5eb4e7aede8ddfcdd313eeb875f4eea860be
tree4ba9a6bbca9fad889446d422016742eba38fdc5c
parentbe8c8facc707d48f367d9313f5972353d24f19be
gpiolib: Fix incorrect use of find_next_zero_bit()

Commit b17566a6b08b ("gpiolib: Implement fast processing path in
get/set array"), already fixed to some extent with commit 5d581d7e8cdc
("gpiolib: Fix missing updates of bitmap index"), introduced a new mode
of processing bitmaps where bits applicable for fast bitmap processing
path are supposed to be skipped while iterating bits which don't apply.
Unfortunately, find_next_zero_bit() function supposed to skip over
those fast bits is always called with a 'start' argument equal to an
index of last zero bit found and returns that index value again an
again, causing an infinite loop.

Fix it by incrementing the index uncoditionally before
find_next_zero_bit() is optionally called.

Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpiolib.c