]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.14.110/gpio-adnp-fix-testing-wrong-value-in-adnp_gpio_direction_input.patch
Linux 4.14.110
[thirdparty/kernel/stable-queue.git] / releases / 4.14.110 / gpio-adnp-fix-testing-wrong-value-in-adnp_gpio_direction_input.patch
CommitLineData
13835fac
GKH
1From c5bc6e526d3f217ed2cc3681d256dc4a2af4cc2b Mon Sep 17 00:00:00 2001
2From: Axel Lin <axel.lin@ingics.com>
3Date: Mon, 11 Mar 2019 21:29:37 +0800
4Subject: gpio: adnp: Fix testing wrong value in adnp_gpio_direction_input
5
6From: Axel Lin <axel.lin@ingics.com>
7
8commit c5bc6e526d3f217ed2cc3681d256dc4a2af4cc2b upstream.
9
10Current code test wrong value so it does not verify if the written
11data is correctly read back. Fix it.
12Also make it return -EPERM if read value does not match written bit,
13just like it done for adnp_gpio_direction_output().
14
15Fixes: 5e969a401a01 ("gpio: Add Avionic Design N-bit GPIO expander support")
16Cc: <stable@vger.kernel.org>
17Signed-off-by: Axel Lin <axel.lin@ingics.com>
18Reviewed-by: Thierry Reding <thierry.reding@gmail.com>
19Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
20Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21
22---
23 drivers/gpio/gpio-adnp.c | 6 ++++--
24 1 file changed, 4 insertions(+), 2 deletions(-)
25
26--- a/drivers/gpio/gpio-adnp.c
27+++ b/drivers/gpio/gpio-adnp.c
28@@ -132,8 +132,10 @@ static int adnp_gpio_direction_input(str
29 if (err < 0)
30 goto out;
31
32- if (err & BIT(pos))
33- err = -EACCES;
34+ if (value & BIT(pos)) {
35+ err = -EPERM;
36+ goto out;
37+ }
38
39 err = 0;
40