From d542ed82fdc72cf63549deec19e86ee4addf2499 Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Thu, 12 Apr 2007 01:30:15 -0400 Subject: Input: handlers - handle errors from input_open_device() Signed-off-by: Dmitry Torokhov --- drivers/input/evdev.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'drivers/input/evdev.c') 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; -- cgit v1.2.1