]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/input/mousedev.c
Input: fix open count handling in input interfaces
[linux-2.6-omap-h63xx.git] / drivers / input / mousedev.c
index 715def79390c68d89017663dedfed82c0bb91d42..cc36edbb912f1b137e24c70941cdd21becff3cfb 100644 (file)
@@ -428,8 +428,11 @@ static int mousedev_open_device(struct mousedev *mousedev)
                mixdev_open_devices();
        else if (!mousedev->exist)
                retval = -ENODEV;
-       else if (!mousedev->open++)
+       else if (!mousedev->open++) {
                retval = input_open_device(&mousedev->handle);
+               if (retval)
+                       mousedev->open--;
+       }
 
        mutex_unlock(&mousedev->mutex);
        return retval;