Commit 3f9ed5c2 authored by Hans de Goede's avatar Hans de Goede Committed by Dmitry Torokhov

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: default avatarHans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20220131143539.109142-1-hdegoede@redhat.comSigned-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 986c6f7c
...@@ -511,6 +511,9 @@ void input_set_abs_params(struct input_dev *dev, unsigned int axis, ...@@ -511,6 +511,9 @@ void input_set_abs_params(struct input_dev *dev, unsigned int axis,
{ {
struct input_absinfo *absinfo; struct input_absinfo *absinfo;
__set_bit(EV_ABS, dev->evbit);
__set_bit(axis, dev->absbit);
input_alloc_absinfo(dev); input_alloc_absinfo(dev);
if (!dev->absinfo) if (!dev->absinfo)
return; return;
...@@ -520,9 +523,6 @@ void input_set_abs_params(struct input_dev *dev, unsigned int axis, ...@@ -520,9 +523,6 @@ void input_set_abs_params(struct input_dev *dev, unsigned int axis,
absinfo->maximum = max; absinfo->maximum = max;
absinfo->fuzz = fuzz; absinfo->fuzz = fuzz;
absinfo->flat = flat; absinfo->flat = flat;
__set_bit(EV_ABS, dev->evbit);
__set_bit(axis, dev->absbit);
} }
EXPORT_SYMBOL(input_set_abs_params); EXPORT_SYMBOL(input_set_abs_params);
...@@ -2085,9 +2085,6 @@ void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int ...@@ -2085,9 +2085,6 @@ void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int
case EV_ABS: case EV_ABS:
input_alloc_absinfo(dev); input_alloc_absinfo(dev);
if (!dev->absinfo)
return;
__set_bit(code, dev->absbit); __set_bit(code, dev->absbit);
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment