summaryrefslogtreecommitdiffstats
path: root/drivers/input/tsdev.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@insightbb.com>2007-04-12 01:30:15 -0400
committerDmitry Torokhov <dtor@insightbb.com>2007-04-12 01:30:15 -0400
commitd542ed82fdc72cf63549deec19e86ee4addf2499 (patch)
tree201c713b24a429d34272998ae3ecca87c937709a /drivers/input/tsdev.c
parentd0ffb9be866519775da19c0a6790f5431c1a8dc6 (diff)
Input: handlers - handle errors from input_open_device()
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/tsdev.c')
-rw-r--r--drivers/input/tsdev.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/input/tsdev.c b/drivers/input/tsdev.c
index fbef35d2d76..8e2d2c924ad 100644
--- a/drivers/input/tsdev.c
+++ b/drivers/input/tsdev.c
@@ -151,6 +151,7 @@ static int tsdev_open(struct inode *inode, struct file *file)
int i = iminor(inode) - TSDEV_MINOR_BASE;
struct tsdev_client *client;
struct tsdev *tsdev;
+ int error;
printk(KERN_WARNING "tsdev (compaq touchscreen emulation) is scheduled "
"for removal.\nSee Documentation/feature-removal-schedule.txt "
@@ -171,8 +172,14 @@ static int tsdev_open(struct inode *inode, struct file *file)
client->raw = (i >= TSDEV_MINORS / 2) ? 1 : 0;
list_add_tail(&client->node, &tsdev->client_list);
- if (!tsdev->open++ && tsdev->exist)
- input_open_device(&tsdev->handle);
+ if (!tsdev->open++ && tsdev->exist) {
+ error = input_open_device(&tsdev->handle);
+ if (error) {
+ list_del(&client->node);
+ kfree(client);
+ return error;
+ }
+ }
file->private_data = client;
return 0;