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) | |
download | linux-d542ed82fdc72cf63549deec19e86ee4addf2499.tar.gz linux-d542ed82fdc72cf63549deec19e86ee4addf2499.tar.bz2 linux-d542ed82fdc72cf63549deec19e86ee4addf2499.zip |
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) struct evdev_client *client; struct evdev *evdev; int i = iminor(inode) - EVDEV_MINOR_BASE; + int error; if (i >= EVDEV_MINORS) return -ENODEV; @@ -146,8 +147,14 @@ static int evdev_open(struct inode *inode, struct file *file) client->evdev = evdev; list_add_tail(&client->node, &evdev->client_list); - if (!evdev->open++ && evdev->exist) - input_open_device(&evdev->handle); + if (!evdev->open++ && evdev->exist) { + error = input_open_device(&evdev->handle); + if (error) { + list_del(&client->node); + kfree(client); + return error; + } + } file->private_data = client; return 0; |