summaryrefslogtreecommitdiff
path: root/drivers/input/tsdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/tsdev.c')
-rw-r--r--drivers/input/tsdev.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/input/tsdev.c b/drivers/input/tsdev.c
index c189f1dd569f..120233493758 100644
--- a/drivers/input/tsdev.c
+++ b/drivers/input/tsdev.c
@@ -185,8 +185,11 @@ static int tsdev_open_device(struct tsdev *tsdev)
if (!tsdev->exist)
retval = -ENODEV;
- else if (!tsdev->open++)
+ else if (!tsdev->open++) {
retval = input_open_device(&tsdev->handle);
+ if (retval)
+ tsdev->open--;
+ }
mutex_unlock(&tsdev->mutex);
return retval;