diff options
author | Dmitry Torokhov <dtor@insightbb.com> | 2006-11-05 22:40:19 -0500 |
---|---|---|
committer | Dmitry Torokhov <dtor@insightbb.com> | 2006-11-05 22:40:19 -0500 |
commit | 721556150e397f606a3f029736d77a27503f94e2 (patch) | |
tree | 1bdce32c4d1421f0dfbd9871986fcb7eaa6aba56 /drivers/input/mouse/sermouse.c | |
parent | 127278ce2254c61f1346500374d61e33f74a8729 (diff) |
Input: mice - handle errors when registering input devices
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/mouse/sermouse.c')
-rw-r--r-- | drivers/input/mouse/sermouse.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/input/mouse/sermouse.c b/drivers/input/mouse/sermouse.c index 2a272c5daf08..10b51e7f01f6 100644 --- a/drivers/input/mouse/sermouse.c +++ b/drivers/input/mouse/sermouse.c @@ -246,7 +246,7 @@ static int sermouse_connect(struct serio *serio, struct serio_driver *drv) sermouse = kzalloc(sizeof(struct sermouse), GFP_KERNEL); input_dev = input_allocate_device(); if (!sermouse || !input_dev) - goto fail; + goto fail1; sermouse->dev = input_dev; snprintf(sermouse->phys, sizeof(sermouse->phys), "%s/input0", serio->phys); @@ -275,14 +275,17 @@ static int sermouse_connect(struct serio *serio, struct serio_driver *drv) err = serio_open(serio, drv); if (err) - goto fail; + goto fail2; - input_register_device(sermouse->dev); + err = input_register_device(sermouse->dev); + if (err) + goto fail3; return 0; - fail: serio_set_drvdata(serio, NULL); - input_free_device(input_dev); + fail3: serio_close(serio); + fail2: serio_set_drvdata(serio, NULL); + fail1: input_free_device(input_dev); kfree(sermouse); return err; } |