summaryrefslogtreecommitdiff
path: root/drivers/input/joydev.c
diff options
context:
space:
mode:
authorOliver Neukum <oliver@neukum.org>2007-10-12 14:18:40 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2007-10-12 14:18:40 -0400
commit064450140f1eab959bd0eca0245f449993216074 (patch)
treeae8c7e238224b74e90f860129b1236c3eeedc470 /drivers/input/joydev.c
parent1ea3abf7fbc39b3b543d7438159ba07b6411561c (diff)
Input: fix open count handling in input interfaces
If input_open_device() fails we should not leave interfaces marked as opened. Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/joydev.c')
-rw-r--r--drivers/input/joydev.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c
index a4272d63c4d6..f306c97f556d 100644
--- a/drivers/input/joydev.c
+++ b/drivers/input/joydev.c
@@ -205,8 +205,11 @@ static int joydev_open_device(struct joydev *joydev)
if (!joydev->exist)
retval = -ENODEV;
- else if (!joydev->open++)
+ else if (!joydev->open++) {
retval = input_open_device(&joydev->handle);
+ if (retval)
+ joydev->open--;
+ }
mutex_unlock(&joydev->mutex);
return retval;