diff mbox

[08/24] atomisp/imx: Fix locking bug on error path

Message ID 149002080343.17109.13144918778111462380.stgit@acox1-desk1.ger.corp.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alan Cox March 20, 2017, 2:40 p.m. UTC
This was reported by Dan Carpenter. When we error with an IMX 227 we don't release
the lock and the sensor would then hang.

Signed-off-by: Alan Cox <alan@linux.intel.com>
---
 drivers/staging/media/atomisp/i2c/imx/imx.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/drivers/staging/media/atomisp/i2c/imx/imx.c b/drivers/staging/media/atomisp/i2c/imx/imx.c
index a73f902..408a7b9 100644
--- a/drivers/staging/media/atomisp/i2c/imx/imx.c
+++ b/drivers/staging/media/atomisp/i2c/imx/imx.c
@@ -454,8 +454,10 @@  static int imx_set_exposure_gain(struct v4l2_subdev *sd, u16 coarse_itg,
 
 	if (dev->sensor_id == IMX227_ID) {
 		ret = imx_write_reg_array(client, imx_param_hold);
-		if (ret)
+		if (ret) {
+			mutex_unlock(&dev->input_lock);
 			return ret;
+		}
 	}
 
 	/* For imx175, setting gain must be delayed by one */