summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2022-02-28 22:57:26 -0800
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2022-02-28 23:26:25 -0800
commit3f9ed5c2fe36794c1b11697bbbc6c8ec82a7d3dc (patch)
tree9d6c6d9bcb6833b1a948766695d55f5e76a1f713 /drivers
parent986c6f7c3fc855032f3457a5a1b7fbcc09c375bb (diff)
downloadlinux-stable-3f9ed5c2fe36794c1b11697bbbc6c8ec82a7d3dc.tar.gz
linux-stable-3f9ed5c2fe36794c1b11697bbbc6c8ec82a7d3dc.tar.bz2
linux-stable-3f9ed5c2fe36794c1b11697bbbc6c8ec82a7d3dc.zip
Input: set EV_ABS in dev->evbit even if input_alloc_absinfo() fails
The input core's error handling for input_alloc_absinfo() failures is based on ignoring the error until input_register_device() runs and then checks for the failure like this: if (test_bit(EV_ABS, dev->evbit) && !dev->absinfo) { dev_err(&dev->dev, ...); return -EINVAL; } This relies on EV_ABS actually getting set in dev->evbit even if input_alloc_absinfo() fails, change input_set_abs_params() and input_set_capability() to actually adhere to this. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20220131143539.109142-1-hdegoede@redhat.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/input/input.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c
index ccaeb2426385..3a5156012fb8 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -511,6 +511,9 @@ void input_set_abs_params(struct input_dev *dev, unsigned int axis,
{
struct input_absinfo *absinfo;
+ __set_bit(EV_ABS, dev->evbit);
+ __set_bit(axis, dev->absbit);
+
input_alloc_absinfo(dev);
if (!dev->absinfo)
return;
@@ -520,9 +523,6 @@ void input_set_abs_params(struct input_dev *dev, unsigned int axis,
absinfo->maximum = max;
absinfo->fuzz = fuzz;
absinfo->flat = flat;
-
- __set_bit(EV_ABS, dev->evbit);
- __set_bit(axis, dev->absbit);
}
EXPORT_SYMBOL(input_set_abs_params);
@@ -2085,9 +2085,6 @@ void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int
case EV_ABS:
input_alloc_absinfo(dev);
- if (!dev->absinfo)
- return;
-
__set_bit(code, dev->absbit);
break;