aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mousedev.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/mousedev.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/mousedev.c')
-rw-r--r--drivers/input/mousedev.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c
index 715def79390c..cc36edbb912f 100644
--- a/drivers/input/mousedev.c
+++ b/drivers/input/mousedev.c
@@ -428,8 +428,11 @@ static int mousedev_open_device(struct mousedev *mousedev)
428 mixdev_open_devices(); 428 mixdev_open_devices();
429 else if (!mousedev->exist) 429 else if (!mousedev->exist)
430 retval = -ENODEV; 430 retval = -ENODEV;
431 else if (!mousedev->open++) 431 else if (!mousedev->open++) {
432 retval = input_open_device(&mousedev->handle); 432 retval = input_open_device(&mousedev->handle);
433 if (retval)
434 mousedev->open--;
435 }
433 436
434 mutex_unlock(&mousedev->mutex); 437 mutex_unlock(&mousedev->mutex);
435 return retval; 438 return retval;