media: i2c: ov08d10: Unlock on error in ov08d10_enum_frame_size()
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 1 Feb 2022 13:00:16 +0000 (14:00 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Thu, 17 Feb 2022 09:00:21 +0000 (10:00 +0100)
This error path needs to drop the mutex to avoid a deadlock.

Fixes: 7be91e02ed57 ("media: i2c: Add ov08d10 camera sensor driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/i2c/ov08d10.c

index 1f42dd714ef627ec805607b568217e9e45afbf8a..e5ef6466a3ec42a5b56f9a0a0fcac48ae617fa3d 100644 (file)
@@ -1264,8 +1264,10 @@ static int ov08d10_enum_frame_size(struct v4l2_subdev *sd,
                return -EINVAL;
 
        mutex_lock(&ov08d10->mutex);
-       if (fse->code != ov08d10_get_format_code(ov08d10))
+       if (fse->code != ov08d10_get_format_code(ov08d10)) {
+               mutex_unlock(&ov08d10->mutex);
                return -EINVAL;
+       }
        mutex_unlock(&ov08d10->mutex);
 
        fse->min_width = ov08d10->priv_lane->sp_modes[fse->index].width;