From 064450140f1eab959bd0eca0245f449993216074 Mon Sep 17 00:00:00 2001 From: Oliver Neukum Date: Fri, 12 Oct 2007 14:18:40 -0400 Subject: 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 Signed-off-by: Dmitry Torokhov --- drivers/input/joydev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'drivers/input/joydev.c') diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c index a4272d63c4d6..f306c97f556d 100644 --- a/drivers/input/joydev.c +++ b/drivers/input/joydev.c @@ -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; -- cgit v1.2.3