@@ -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:
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@maxwell.research.nokia.com> --- drivers/media/video/omap24xxcam.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)