aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/mtouch.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@insightbb.com>2006-11-05 22:40:03 -0500
committerDmitry Torokhov <dtor@insightbb.com>2006-11-05 22:40:03 -0500
commit52c1f5704d7555a16641429b2e7af5d26d7b119a (patch)
treeeb55cec7167646ba18f09d7d4b0009712fe45062 /drivers/input/touchscreen/mtouch.c
parent2b03b60e6b8635fffdd15d5d24943950f2bbf96e (diff)
Input: touchscreens - handle errors when registering input devices
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/touchscreen/mtouch.c')
-rw-r--r--drivers/input/touchscreen/mtouch.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/input/touchscreen/mtouch.c b/drivers/input/touchscreen/mtouch.c
index 3b4c61664b63..c66b399774f2 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)
137 input_dev = input_allocate_device(); 137 input_dev = input_allocate_device();
138 if (!mtouch || !input_dev) { 138 if (!mtouch || !input_dev) {
139 err = -ENOMEM; 139 err = -ENOMEM;
140 goto fail; 140 goto fail1;
141 } 141 }
142 142
143 mtouch->serio = serio; 143 mtouch->serio = serio;
@@ -160,14 +160,17 @@ static int mtouch_connect(struct serio *serio, struct serio_driver *drv)
160 160
161 err = serio_open(serio, drv); 161 err = serio_open(serio, drv);
162 if (err) 162 if (err)
163 goto fail; 163 goto fail2;
164 164
165 input_register_device(mtouch->dev); 165 err = input_register_device(mtouch->dev);
166 if (err)
167 goto fail3;
166 168
167 return 0; 169 return 0;
168 170
169 fail: serio_set_drvdata(serio, NULL); 171 fail3: serio_close(serio);
170 input_free_device(input_dev); 172 fail2: serio_set_drvdata(serio, NULL);
173 fail1: input_free_device(input_dev);
171 kfree(mtouch); 174 kfree(mtouch);
172 return err; 175 return err;
173} 176}