[PATCH -next] media: i2c: ov08d10: Fix missing unlock on error in ov08d10_enum_frame_size()

Yang Yingliang posted 1 patch 4 years, 4 months ago
drivers/media/i2c/ov08d10.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
[PATCH -next] media: i2c: ov08d10: Fix missing unlock on error in ov08d10_enum_frame_size()
Posted by Yang Yingliang 4 years, 4 months ago
Add the missing unlock before return from function ov08d10_enum_frame_size()
in the error handling case.

Fixes: 7be91e02ed57 ("media: i2c: Add ov08d10 camera sensor driver")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/media/i2c/ov08d10.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/ov08d10.c b/drivers/media/i2c/ov08d10.c
index 1f42dd714ef6..e5ef6466a3ec 100644
--- a/drivers/media/i2c/ov08d10.c
+++ b/drivers/media/i2c/ov08d10.c
@@ -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;
-- 
2.25.1