Decrease use count back if omap24xxcam_sensor_enable() fails in omap24xxcam_open(). Thanks to Hans Verkuil for pointing this out. Compile tested only. Signed-off-by: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxxxxxxxxxxxxx> --- drivers/media/video/omap24xxcam.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/video/omap24xxcam.c b/drivers/media/video/omap24xxcam.c index 73eb656..3002051 100644 --- a/drivers/media/video/omap24xxcam.c +++ b/drivers/media/video/omap24xxcam.c @@ -1476,10 +1476,8 @@ static int omap24xxcam_open(struct file *file) if (atomic_inc_return(&cam->users) == 1) { omap24xxcam_hwinit(cam); - if (omap24xxcam_sensor_enable(cam)) { - mutex_unlock(&cam->mutex); + if (omap24xxcam_sensor_enable(cam)) goto out_omap24xxcam_sensor_enable; - } } mutex_unlock(&cam->mutex); @@ -1502,7 +1500,9 @@ static int omap24xxcam_open(struct file *file) return 0; out_omap24xxcam_sensor_enable: + atomic_dec(&cam->users); omap24xxcam_poweron_reset(cam); + mutex_unlock(&cam->mutex); module_put(cam->sdev->module); out_try_module_get: -- 1.5.6.5 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html