summaryrefslogtreecommitdiffstats
path: root/drivers/input/keyboard
diff options
context:
space:
mode:
authorPeng Fan <van.freenix@gmail.com>2015-08-24 10:42:25 -0700
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2015-08-24 10:55:48 -0700
commit4ea14a53d8f881034fa9e186653821c4e3d9a8fb (patch)
treedf31921a1b3aecb872c39f15d4156efd821b34fb /drivers/input/keyboard
parentff89de6ba1d41ad4dea2c59531c5b4038ae43e8c (diff)
downloadlinux-4ea14a53d8f881034fa9e186653821c4e3d9a8fb.tar.bz2
Input: gpio-keys - report error when disabling unsupported key
When trying to disable a key that is not supported by the device we should report error, not do nothing and report success: root@yocto:/sys/devices/soc0/gpio-keys# cat keys 114-116 root@yocto:/sys/devices/soc0/gpio-keys# echo 77 > keys root@yocto:/sys/devices/soc0/gpio-keys# We want 'echo 77 > keys' to report an error, but silence to give us an illusion that all is 'ok'. Signed-off-by: Peng Fan <van.freenix@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/keyboard')
-rw-r--r--drivers/input/keyboard/gpio_keys.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index 1df4507c4c0b..9d517ca7eb5a 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -239,6 +239,11 @@ static ssize_t gpio_keys_attr_store_helper(struct gpio_keys_drvdata *ddata,
}
}
+ if (i == ddata->pdata->nbuttons) {
+ error = -EINVAL;
+ goto out;
+ }
+
mutex_lock(&ddata->disable_lock);
for (i = 0; i < ddata->pdata->nbuttons; i++) {