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/joydev.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/joydev.c')
-rw-r--r-- | drivers/input/joydev.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c index 09b8223de5ec..4f37224d2268 100644 --- a/drivers/input/joydev.c +++ b/drivers/input/joydev.c | |||
@@ -170,6 +170,7 @@ static int joydev_open(struct inode *inode, struct file *file) | |||
170 | struct joydev_client *client; | 170 | struct joydev_client *client; |
171 | struct joydev *joydev; | 171 | struct joydev *joydev; |
172 | int i = iminor(inode) - JOYDEV_MINOR_BASE; | 172 | int i = iminor(inode) - JOYDEV_MINOR_BASE; |
173 | int error; | ||
173 | 174 | ||
174 | if (i >= JOYDEV_MINORS) | 175 | if (i >= JOYDEV_MINORS) |
175 | return -ENODEV; | 176 | return -ENODEV; |
@@ -185,8 +186,14 @@ static int joydev_open(struct inode *inode, struct file *file) | |||
185 | client->joydev = joydev; | 186 | client->joydev = joydev; |
186 | list_add_tail(&client->node, &joydev->client_list); | 187 | list_add_tail(&client->node, &joydev->client_list); |
187 | 188 | ||
188 | if (!joydev->open++ && joydev->exist) | 189 | if (!joydev->open++ && joydev->exist) { |
189 | input_open_device(&joydev->handle); | 190 | error = input_open_device(&joydev->handle); |
191 | if (error) { | ||
192 | list_del(&client->node); | ||
193 | kfree(client); | ||
194 | return error; | ||
195 | } | ||
196 | } | ||
190 | 197 | ||
191 | file->private_data = client; | 198 | file->private_data = client; |
192 | return 0; | 199 | return 0; |