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

Commit 4ea14a53 authored by Peng Fan's avatar Peng Fan Committed by Dmitry Torokhov
Browse files

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: default avatarPeng Fan <van.freenix@gmail.com>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent ff89de6b
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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++) {