|
@@ -480,11 +480,19 @@ EXPORT_SYMBOL(input_inject_event);
|
|
|
*/
|
|
|
void input_alloc_absinfo(struct input_dev *dev)
|
|
|
{
|
|
|
- if (!dev->absinfo)
|
|
|
- dev->absinfo = kcalloc(ABS_CNT, sizeof(*dev->absinfo),
|
|
|
- GFP_KERNEL);
|
|
|
+ if (dev->absinfo)
|
|
|
+ return;
|
|
|
|
|
|
- WARN(!dev->absinfo, "%s(): kcalloc() failed?\n", __func__);
|
|
|
+ dev->absinfo = kcalloc(ABS_CNT, sizeof(*dev->absinfo), GFP_KERNEL);
|
|
|
+ if (!dev->absinfo) {
|
|
|
+ dev_err(dev->dev.parent ?: &dev->dev,
|
|
|
+ "%s: unable to allocate memory\n", __func__);
|
|
|
+ /*
|
|
|
+ * We will handle this allocation failure in
|
|
|
+ * input_register_device() when we refuse to register input
|
|
|
+ * device with ABS bits but without absinfo.
|
|
|
+ */
|
|
|
+ }
|
|
|
}
|
|
|
EXPORT_SYMBOL(input_alloc_absinfo);
|
|
|
|