diff options
author | Dmitry Torokhov <dtor@insightbb.com> | 2006-08-05 00:27:00 -0400 |
---|---|---|
committer | Dmitry Torokhov <dtor@insightbb.com> | 2006-08-05 00:27:00 -0400 |
commit | 6b50d8b862284929314e9ff09e5b1cce2c43d32b (patch) | |
tree | 76b6358dff4bfe18342fb02817e1dc54db4e1cd0 /drivers/input/touchscreen | |
parent | f287caee8094097e3901d9982b6780873b36944f (diff) |
Input: elo - handle input_register_device() failures
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/touchscreen')
-rw-r--r-- | drivers/input/touchscreen/elo.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/input/touchscreen/elo.c b/drivers/input/touchscreen/elo.c index c86a2eb310fd..b7ac016219d9 100644 --- a/drivers/input/touchscreen/elo.c +++ b/drivers/input/touchscreen/elo.c | |||
@@ -187,11 +187,13 @@ static irqreturn_t elo_interrupt(struct serio *serio, | |||
187 | 187 | ||
188 | static void elo_disconnect(struct serio *serio) | 188 | static void elo_disconnect(struct serio *serio) |
189 | { | 189 | { |
190 | struct elo* elo = serio_get_drvdata(serio); | 190 | struct elo *elo = serio_get_drvdata(serio); |
191 | 191 | ||
192 | input_get_device(elo->dev); | ||
192 | input_unregister_device(elo->dev); | 193 | input_unregister_device(elo->dev); |
193 | serio_close(serio); | 194 | serio_close(serio); |
194 | serio_set_drvdata(serio, NULL); | 195 | serio_set_drvdata(serio, NULL); |
196 | input_put_device(elo->dev); | ||
195 | kfree(elo); | 197 | kfree(elo); |
196 | } | 198 | } |
197 | 199 | ||
@@ -211,7 +213,7 @@ static int elo_connect(struct serio *serio, struct serio_driver *drv) | |||
211 | input_dev = input_allocate_device(); | 213 | input_dev = input_allocate_device(); |
212 | if (!elo || !input_dev) { | 214 | if (!elo || !input_dev) { |
213 | err = -ENOMEM; | 215 | err = -ENOMEM; |
214 | goto fail; | 216 | goto fail1; |
215 | } | 217 | } |
216 | 218 | ||
217 | elo->serio = serio; | 219 | elo->serio = serio; |
@@ -257,13 +259,17 @@ static int elo_connect(struct serio *serio, struct serio_driver *drv) | |||
257 | 259 | ||
258 | err = serio_open(serio, drv); | 260 | err = serio_open(serio, drv); |
259 | if (err) | 261 | if (err) |
260 | goto fail; | 262 | goto fail2; |
263 | |||
264 | err = input_register_device(elo->dev); | ||
265 | if (err) | ||
266 | goto fail3; | ||
261 | 267 | ||
262 | input_register_device(elo->dev); | ||
263 | return 0; | 268 | return 0; |
264 | 269 | ||
265 | fail: serio_set_drvdata(serio, NULL); | 270 | fail3: serio_close(serio); |
266 | input_free_device(input_dev); | 271 | fail2: serio_set_drvdata(serio, NULL); |
272 | fail1: input_free_device(input_dev); | ||
267 | kfree(elo); | 273 | kfree(elo); |
268 | return err; | 274 | return err; |
269 | } | 275 | } |