mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-04 18:19:28 +09:00
gpio: adnp: Fix testing wrong value in adnp_gpio_direction_input
commitc5bc6e526dupstream. Current code test wrong value so it does not verify if the written data is correctly read back. Fix it. Also make it return -EPERM if read value does not match written bit, just like it done for adnp_gpio_direction_output(). Fixes:5e969a401a("gpio: Add Avionic Design N-bit GPIO expander support") Cc: <stable@vger.kernel.org> Signed-off-by: Axel Lin <axel.lin@ingics.com> Reviewed-by: Thierry Reding <thierry.reding@gmail.com> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
e708e5db25
commit
5d4cc25d57
@@ -132,8 +132,10 @@ static int adnp_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
|
||||
if (err < 0)
|
||||
goto out;
|
||||
|
||||
if (err & BIT(pos))
|
||||
err = -EACCES;
|
||||
if (value & BIT(pos)) {
|
||||
err = -EPERM;
|
||||
goto out;
|
||||
}
|
||||
|
||||
err = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user