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

gpio: adnp: Fix testing wrong value in adnp_gpio_direction_input

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: 5e969a401a01 ("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>

authored by

Axel Lin and committed by
Bartosz Golaszewski
c5bc6e52 7ecced09

+4 -2
+4 -2
drivers/gpio/gpio-adnp.c
··· 132 132 if (err < 0) 133 133 goto out; 134 134 135 - if (err & BIT(pos)) 136 - err = -EACCES; 135 + if (value & BIT(pos)) { 136 + err = -EPERM; 137 + goto out; 138 + } 137 139 138 140 err = 0; 139 141