media: i2c: ov08d10: Unlock on error in ov08d10_enum_frame_size()
Sakari Ailus
maintainerPATCH 1/1 media: i2c: ov08d10: Unlock on error in ov08d10_enum_frame_size()
From: Dan Carpenter <[email protected]>
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 <[email protected]>
Signed-off-by Sakari Ailus <[email protected]>
--- drivers/media/i2c/ov08d10.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/i2c/ov08d10.c +3 -1
@@ -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;
Signature · 1 line
2.30.2
Quoted 7 lines · Sakari Ailus
From: Dan Carpenter <[email protected]>
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 <[email protected]>Signed-off-by Sakari Ailus <[email protected]>
I want RAII in C :-)
Reviewed-by Laurent Pinchart <[email protected]>
Quoted 20 lines
--- drivers/media/i2c/ov08d10.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/media/i2c/ov08d10.c +3
-1@@ -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;
Signature · 3 lines
Regards, Laurent Pinchart
Sakari Ailus
maintainerHi Laurent,
Quoted 5 lines · Laurent Pinchart
Quoted 4 lines · Sakari Ailus
From: Dan Carpenter <[email protected]>
This error path needs to drop the mutex to avoid a deadlock.
Quoted 7 lines
Quoted 3 lines
Fixes 7be91e02ed57 ("media: i2c: Add ov08d10 camera sensor driver")Signed-off-by Dan Carpenter <[email protected]>Signed-off-by Sakari Ailus <[email protected]>I want RAII in C :-)
Reviewed-by Laurent Pinchart <[email protected]>
Oops. This wasn't the patch I intended to send. But thanks for the
Reviewed-by: nonetheless. :-)
Signature · 1 line
Sakari Ailus