]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/input/tsdev.c
Input: fix open count handling in input interfaces
[linux-2.6-omap-h63xx.git] / drivers / input / tsdev.c
index c189f1dd569f42f3451eae6e8bda519f47fc7fed..120233493758456294e3a162a8f6c30f2f35e5db 100644 (file)
@@ -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;