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>
This commit is contained in:
committed by
Dmitry Torokhov
parent
1ea3abf7fb
commit
064450140f
@@ -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;
|
||||
|
Reference in New Issue
Block a user