atomisp/imx: Fix locking bug on error path
authorAlan Cox <[email protected]>
Mon, 20 Mar 2017 14:40:06 +0000 (14:40 +0000)
committerGreg Kroah-Hartman <[email protected]>
Tue, 21 Mar 2017 07:04:32 +0000 (08:04 +0100)
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 <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/staging/media/atomisp/i2c/imx/imx.c

index a73f90282c8942c7ffd8edacdcd78ca9554fa837..408a7b945153c9b2c4d6582e2e1355919be576af 100644 (file)
@@ -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 */