diff options
| -rw-r--r-- | drivers/input/input.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c index 6365c1958264..3304aaaffe87 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
| @@ -480,11 +480,19 @@ EXPORT_SYMBOL(input_inject_event); | |||
| 480 | */ | 480 | */ |
| 481 | void input_alloc_absinfo(struct input_dev *dev) | 481 | void input_alloc_absinfo(struct input_dev *dev) |
| 482 | { | 482 | { |
| 483 | if (!dev->absinfo) | 483 | if (dev->absinfo) |
| 484 | dev->absinfo = kcalloc(ABS_CNT, sizeof(*dev->absinfo), | 484 | return; |
| 485 | GFP_KERNEL); | ||
| 486 | 485 | ||
| 487 | WARN(!dev->absinfo, "%s(): kcalloc() failed?\n", __func__); | 486 | dev->absinfo = kcalloc(ABS_CNT, sizeof(*dev->absinfo), GFP_KERNEL); |
| 487 | if (!dev->absinfo) { | ||
| 488 | dev_err(dev->dev.parent ?: &dev->dev, | ||
| 489 | "%s: unable to allocate memory\n", __func__); | ||
| 490 | /* | ||
| 491 | * We will handle this allocation failure in | ||
| 492 | * input_register_device() when we refuse to register input | ||
| 493 | * device with ABS bits but without absinfo. | ||
| 494 | */ | ||
| 495 | } | ||
| 488 | } | 496 | } |
| 489 | EXPORT_SYMBOL(input_alloc_absinfo); | 497 | EXPORT_SYMBOL(input_alloc_absinfo); |
| 490 | 498 | ||
