From 52c1f5704d7555a16641429b2e7af5d26d7b119a Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Sun, 5 Nov 2006 22:40:03 -0500 Subject: Input: touchscreens - handle errors when registering input devices Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/mtouch.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'drivers/input/touchscreen/mtouch.c') diff --git a/drivers/input/touchscreen/mtouch.c b/drivers/input/touchscreen/mtouch.c index 3b4c61664b6..c66b399774f 100644 --- a/drivers/input/touchscreen/mtouch.c +++ b/drivers/input/touchscreen/mtouch.c @@ -137,7 +137,7 @@ static int mtouch_connect(struct serio *serio, struct serio_driver *drv) input_dev = input_allocate_device(); if (!mtouch || !input_dev) { err = -ENOMEM; - goto fail; + goto fail1; } mtouch->serio = serio; @@ -160,14 +160,17 @@ static int mtouch_connect(struct serio *serio, struct serio_driver *drv) err = serio_open(serio, drv); if (err) - goto fail; + goto fail2; - input_register_device(mtouch->dev); + err = input_register_device(mtouch->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(mtouch); return err; } -- cgit v1.2.3