From 6b90e928885a0e1d8ab7b92f9533b0d3199b9a36 Mon Sep 17 00:00:00 2001 From: chengxue Date: Mon, 28 Sep 2020 21:38:49 +0800 Subject: [PATCH] msm: camera: cci: Add back mutex on cci there should be a race condition on rd_done read/write between cam_cci_irq and cam_cci_read_bytes, add mutex to avoid. CRs-Fixed: 2786609 Change-Id: Ic55976133bfdc7958b4b3c8b0efdf896f82e7ccf Signed-off-by: chengxue --- drivers/cam_sensor_module/cam_cci/cam_cci_core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/cam_sensor_module/cam_cci/cam_cci_core.c b/drivers/cam_sensor_module/cam_cci/cam_cci_core.c index 0d1b90932eeb..6f41d870babf 100644 --- a/drivers/cam_sensor_module/cam_cci/cam_cci_core.c +++ b/drivers/cam_sensor_module/cam_cci/cam_cci_core.c @@ -1725,8 +1725,10 @@ static int32_t cam_cci_read_bytes(struct v4l2_subdev *sd, * THRESHOLD irq's, we reinit the threshold wait before * we load the burst read cmd. */ + mutex_lock(&cci_dev->cci_master_info[master].mutex_q[QUEUE_1]); reinit_completion(&cci_dev->cci_master_info[master].rd_done); reinit_completion(&cci_dev->cci_master_info[master].th_complete); + mutex_unlock(&cci_dev->cci_master_info[master].mutex_q[QUEUE_1]); CAM_DBG(CAM_CCI, "Bytes to read %u", read_bytes); do {