Input: egalax_ts_serial - fix potential NULL dereference on error

We didn't check input_allocate_device() for failures so it could lead to
a NULL deref.

Fixes: 6b0f8f9c52 ('Input: add eGalaxTouch serial touchscreen driver')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This commit is contained in:
Dan Carpenter 2015-12-19 09:22:21 -08:00 committed by Dmitry Torokhov
parent daf6cd0c18
commit 8dcb3c7628
1 changed files with 1 additions and 1 deletions

View File

@ -105,7 +105,7 @@ static int egalax_connect(struct serio *serio, struct serio_driver *drv)
egalax = kzalloc(sizeof(struct egalax), GFP_KERNEL);
input_dev = input_allocate_device();
if (!egalax) {
if (!egalax || !input_dev) {
error = -ENOMEM;
goto err_free_mem;
}