diff options
author | Dmitry Torokhov <dtor@insightbb.com> | 2007-04-12 01:30:15 -0400 |
---|---|---|
committer | Dmitry Torokhov <dtor@insightbb.com> | 2007-04-12 01:30:15 -0400 |
commit | d542ed82fdc72cf63549deec19e86ee4addf2499 (patch) | |
tree | 201c713b24a429d34272998ae3ecca87c937709a /drivers/input/evdev.c | |
parent | d0ffb9be866519775da19c0a6790f5431c1a8dc6 (diff) |
Input: handlers - handle errors from input_open_device()
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/evdev.c')
-rw-r--r-- | drivers/input/evdev.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index 8a4cce5c7806..6cff8096d56a 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c | |||
@@ -130,6 +130,7 @@ static int evdev_open(struct inode *inode, struct file *file) | |||
130 | struct evdev_client *client; | 130 | struct evdev_client *client; |
131 | struct evdev *evdev; | 131 | struct evdev *evdev; |
132 | int i = iminor(inode) - EVDEV_MINOR_BASE; | 132 | int i = iminor(inode) - EVDEV_MINOR_BASE; |
133 | int error; | ||
133 | 134 | ||
134 | if (i >= EVDEV_MINORS) | 135 | if (i >= EVDEV_MINORS) |
135 | return -ENODEV; | 136 | return -ENODEV; |
@@ -146,8 +147,14 @@ static int evdev_open(struct inode *inode, struct file *file) | |||
146 | client->evdev = evdev; | 147 | client->evdev = evdev; |
147 | list_add_tail(&client->node, &evdev->client_list); | 148 | list_add_tail(&client->node, &evdev->client_list); |
148 | 149 | ||
149 | if (!evdev->open++ && evdev->exist) | 150 | if (!evdev->open++ && evdev->exist) { |
150 | input_open_device(&evdev->handle); | 151 | error = input_open_device(&evdev->handle); |
152 | if (error) { | ||
153 | list_del(&client->node); | ||
154 | kfree(client); | ||
155 | return error; | ||
156 | } | ||
157 | } | ||
151 | 158 | ||
152 | file->private_data = client; | 159 | file->private_data = client; |
153 | return 0; | 160 | return 0; |