Skip to content
Commit 67a76aaf authored by Linus Walleij's avatar Linus Walleij
Browse files

gpio: generic: clamp values from bgpio_get_set()

The bgpio_get_set() call should return a value clamped to [0,1],
the current code will return a negative value if reading
bit 31, which turns the value negative as this is a signed value
and thus gets interpreted as an error by the gpiolib core.
Found on the gpio-mxc but applies to any MMIO driver.

Cc: stable@vger.kernel.org # 4.3+
Cc: kernel@pengutronix.de
Cc: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Fixes:  e20538b8

 ("gpio: Propagate errors from chip->get()")
Reported-by: default avatarClemens Gruber <clemens.gruber@pqgruber.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 3a57e741
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment