aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mousedev.c
diff options
context:
space:
mode:
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 715def79390..cc36edbb912 100644
--- a/drivers/input/mousedev.c
+++ b/drivers/input/mousedev.c
@@ -428,8 +428,11 @@ static int mousedev_open_device(struct mousedev *mousedev)
mixdev_open_devices();
else if (!mousedev->exist)
retval = -ENODEV;
- else if (!mousedev->open++)
+ else if (!mousedev->open++) {
retval = input_open_device(&mousedev->handle);
+ if (retval)
+ mousedev->open--;
+ }
mutex_unlock(&mousedev->mutex);
return retval;