aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse/alps.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/mouse/alps.c')
-rw-r--r--drivers/input/mouse/alps.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 4e71a66fc7fc..cf3e4664e72b 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -424,14 +424,15 @@ int alps_init(struct psmouse *psmouse)
424 struct input_dev *dev1 = psmouse->dev, *dev2; 424 struct input_dev *dev1 = psmouse->dev, *dev2;
425 int version; 425 int version;
426 426
427 psmouse->private = priv = kzalloc(sizeof(struct alps_data), GFP_KERNEL); 427 priv = kzalloc(sizeof(struct alps_data), GFP_KERNEL);
428 dev2 = input_allocate_device(); 428 dev2 = input_allocate_device();
429 if (!priv || !dev2) 429 if (!priv || !dev2)
430 goto init_fail; 430 goto init_fail;
431 431
432 priv->dev2 = dev2; 432 priv->dev2 = dev2;
433 433
434 if (!(priv->i = alps_get_model(psmouse, &version))) 434 priv->i = alps_get_model(psmouse, &version);
435 if (!priv->i)
435 goto init_fail; 436 goto init_fail;
436 437
437 if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 1)) 438 if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 1))
@@ -480,7 +481,8 @@ int alps_init(struct psmouse *psmouse)
480 dev2->relbit[LONG(REL_X)] |= BIT(REL_X) | BIT(REL_Y); 481 dev2->relbit[LONG(REL_X)] |= BIT(REL_X) | BIT(REL_Y);
481 dev2->keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); 482 dev2->keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);
482 483
483 input_register_device(priv->dev2); 484 if (input_register_device(priv->dev2))
485 goto init_fail;
484 486
485 psmouse->protocol_handler = alps_process_byte; 487 psmouse->protocol_handler = alps_process_byte;
486 psmouse->poll = alps_poll; 488 psmouse->poll = alps_poll;
@@ -491,9 +493,11 @@ int alps_init(struct psmouse *psmouse)
491 /* We are having trouble resyncing ALPS touchpads so disable it for now */ 493 /* We are having trouble resyncing ALPS touchpads so disable it for now */
492 psmouse->resync_time = 0; 494 psmouse->resync_time = 0;
493 495
496 psmouse->private = priv;
494 return 0; 497 return 0;
495 498
496init_fail: 499init_fail:
500 psmouse_reset(psmouse);
497 input_free_device(dev2); 501 input_free_device(dev2);
498 kfree(priv); 502 kfree(priv);
499 return -1; 503 return -1;
@@ -504,7 +508,8 @@ int alps_detect(struct psmouse *psmouse, int set_properties)
504 int version; 508 int version;
505 const struct alps_model_info *model; 509 const struct alps_model_info *model;
506 510
507 if (!(model = alps_get_model(psmouse, &version))) 511 model = alps_get_model(psmouse, &version);
512 if (!model)
508 return -1; 513 return -1;
509 514
510 if (set_properties) { 515 if (set_properties) {