aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse/sermouse.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@insightbb.com>2006-11-05 22:40:19 -0500
committerDmitry Torokhov <dtor@insightbb.com>2006-11-05 22:40:19 -0500
commit721556150e397f606a3f029736d77a27503f94e2 (patch)
tree1bdce32c4d1421f0dfbd9871986fcb7eaa6aba56 /drivers/input/mouse/sermouse.c
parent127278ce2254c61f1346500374d61e33f74a8729 (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.c13
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)
246 sermouse = kzalloc(sizeof(struct sermouse), GFP_KERNEL); 246 sermouse = kzalloc(sizeof(struct sermouse), GFP_KERNEL);
247 input_dev = input_allocate_device(); 247 input_dev = input_allocate_device();
248 if (!sermouse || !input_dev) 248 if (!sermouse || !input_dev)
249 goto fail; 249 goto fail1;
250 250
251 sermouse->dev = input_dev; 251 sermouse->dev = input_dev;
252 snprintf(sermouse->phys, sizeof(sermouse->phys), "%s/input0", serio->phys); 252 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)
275 275
276 err = serio_open(serio, drv); 276 err = serio_open(serio, drv);
277 if (err) 277 if (err)
278 goto fail; 278 goto fail2;
279 279
280 input_register_device(sermouse->dev); 280 err = input_register_device(sermouse->dev);
281 if (err)
282 goto fail3;
281 283
282 return 0; 284 return 0;
283 285
284 fail: serio_set_drvdata(serio, NULL); 286 fail3: serio_close(serio);
285 input_free_device(input_dev); 287 fail2: serio_set_drvdata(serio, NULL);
288 fail1: input_free_device(input_dev);
286 kfree(sermouse); 289 kfree(sermouse);
287 return err; 290 return err;
288} 291}