Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f42649e84831efc69d5f621f1c36a39b4e384a99
Commit:     f42649e84831efc69d5f621f1c36a39b4e384a99
Parent:     f3901d9e3bf2b57604358eea62f3414000772e2a
Author:     Dmitry Torokhov <[EMAIL PROTECTED]>
AuthorDate: Thu Apr 12 01:31:13 2007 -0400
Committer:  Dmitry Torokhov <[EMAIL PROTECTED]>
CommitDate: Thu Apr 12 01:31:13 2007 -0400

    Input: ALPS - handle errors from input_register_device()
    
    Signed-off-by: Dmitry Torokhov <[EMAIL PROTECTED]>
---
 drivers/input/mouse/alps.c |   13 +++++++++----
 drivers/input/mouse/alps.h |    1 -
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 4e71a66..cf3e466 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -424,14 +424,15 @@ int alps_init(struct psmouse *psmouse)
        struct input_dev *dev1 = psmouse->dev, *dev2;
        int version;
 
-       psmouse->private = priv = kzalloc(sizeof(struct alps_data), GFP_KERNEL);
+       priv = kzalloc(sizeof(struct alps_data), GFP_KERNEL);
        dev2 = input_allocate_device();
        if (!priv || !dev2)
                goto init_fail;
 
        priv->dev2 = dev2;
 
-       if (!(priv->i = alps_get_model(psmouse, &version)))
+       priv->i = alps_get_model(psmouse, &version);
+       if (!priv->i)
                goto init_fail;
 
        if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 1))
@@ -480,7 +481,8 @@ int alps_init(struct psmouse *psmouse)
        dev2->relbit[LONG(REL_X)] |= BIT(REL_X) | BIT(REL_Y);
        dev2->keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | 
BIT(BTN_RIGHT);
 
-       input_register_device(priv->dev2);
+       if (input_register_device(priv->dev2))
+               goto init_fail;
 
        psmouse->protocol_handler = alps_process_byte;
        psmouse->poll = alps_poll;
@@ -491,9 +493,11 @@ int alps_init(struct psmouse *psmouse)
        /* We are having trouble resyncing ALPS touchpads so disable it for now 
*/
        psmouse->resync_time = 0;
 
+       psmouse->private = priv;
        return 0;
 
 init_fail:
+       psmouse_reset(psmouse);
        input_free_device(dev2);
        kfree(priv);
        return -1;
@@ -504,7 +508,8 @@ int alps_detect(struct psmouse *psmouse, int set_properties)
        int version;
        const struct alps_model_info *model;
 
-       if (!(model = alps_get_model(psmouse, &version)))
+       model = alps_get_model(psmouse, &version);
+       if (!model)
                return -1;
 
        if (set_properties) {
diff --git a/drivers/input/mouse/alps.h b/drivers/input/mouse/alps.h
index f85ac40..4bbddc9 100644
--- a/drivers/input/mouse/alps.h
+++ b/drivers/input/mouse/alps.h
@@ -20,7 +20,6 @@ struct alps_model_info {
 
 struct alps_data {
        struct input_dev *dev2;         /* Relative device */
-       char name[32];                  /* Name */
        char phys[32];                  /* Phys */
        const struct alps_model_info *i;/* Info */
        int prev_fin;                   /* Finger bit from previous packet */
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to