diff options
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; |