Skip to content

Commit c5bc6e5

Browse files
AxelLinbrgl
authored andcommitted
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: 5e969a4 ("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>
1 parent 7ecced0 commit c5bc6e5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/gpio/gpio-adnp.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,10 @@ static int adnp_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
132132
if (err < 0)
133133
goto out;
134134

135-
if (err & BIT(pos))
136-
err = -EACCES;
135+
if (value & BIT(pos)) {
136+
err = -EPERM;
137+
goto out;
138+
}
137139

138140
err = 0;
139141

0 commit comments

Comments
 (0)