diff options
author | Oliver Neukum <oliver@neukum.org> | 2007-10-12 14:18:40 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2007-10-12 14:18:40 -0400 |
commit | 064450140f1eab959bd0eca0245f449993216074 (patch) | |
tree | ae8c7e238224b74e90f860129b1236c3eeedc470 /drivers/input/tsdev.c | |
parent | 1ea3abf7fbc39b3b543d7438159ba07b6411561c (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/tsdev.c')
-rw-r--r-- | drivers/input/tsdev.c | 5 |
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) | |||
185 | 185 | ||
186 | if (!tsdev->exist) | 186 | if (!tsdev->exist) |
187 | retval = -ENODEV; | 187 | retval = -ENODEV; |
188 | else if (!tsdev->open++) | 188 | else if (!tsdev->open++) { |
189 | retval = input_open_device(&tsdev->handle); | 189 | retval = input_open_device(&tsdev->handle); |
190 | if (retval) | ||
191 | tsdev->open--; | ||
192 | } | ||
190 | 193 | ||
191 | mutex_unlock(&tsdev->mutex); | 194 | mutex_unlock(&tsdev->mutex); |
192 | return retval; | 195 | return retval; |