diff options
author | Axel Lin <axel.lin@ingics.com> | 2019-03-11 09:29:37 -0400 |
---|---|---|
committer | Bartosz Golaszewski <bgolaszewski@baylibre.com> | 2019-03-22 11:48:47 -0400 |
commit | c5bc6e526d3f217ed2cc3681d256dc4a2af4cc2b (patch) | |
tree | cdb68a6c7101ce5df45e742da2edeb2b80923e73 /drivers/gpio | |
parent | 7ecced0934e574b528a1ba6c237731e682216a74 (diff) |
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>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpio-adnp.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/gpio/gpio-adnp.c b/drivers/gpio/gpio-adnp.c index 91b90c0cea73..12acdac85820 100644 --- a/drivers/gpio/gpio-adnp.c +++ b/drivers/gpio/gpio-adnp.c | |||
@@ -132,8 +132,10 @@ static int adnp_gpio_direction_input(struct gpio_chip *chip, unsigned offset) | |||
132 | if (err < 0) | 132 | if (err < 0) |
133 | goto out; | 133 | goto out; |
134 | 134 | ||
135 | if (err & BIT(pos)) | 135 | if (value & BIT(pos)) { |
136 | err = -EACCES; | 136 | err = -EPERM; |
137 | goto out; | ||
138 | } | ||
137 | 139 | ||
138 | err = 0; | 140 | err = 0; |
139 | 141 | ||