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