Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c5bc6e52 authored by Axel Lin's avatar Axel Lin Committed by Bartosz Golaszewski
Browse files

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: 5e969a40 ("gpio: Add Avionic Design N-bit GPIO expander support")
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Reviewed-by: default avatarThierry Reding <thierry.reding@gmail.com>
Signed-off-by: default avatarBartosz Golaszewski <bgolaszewski@baylibre.com>
parent 7ecced09
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -132,8 +132,10 @@ static int adnp_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
	if (err < 0)
	if (err < 0)
		goto out;
		goto out;


	if (err & BIT(pos))
	if (value & BIT(pos)) {
		err = -EACCES;
		err = -EPERM;
		goto out;
	}


	err = 0;
	err = 0;