Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dcc70d2c authored by Abhilash Kumar's avatar Abhilash Kumar Committed by Gerrit - the friendly Code Review server
Browse files

msm: camera: icp: Execute irq callbacks with locks



During hardware release, there is a chance of executing the
irq, since disable_irq is done later. This can cause irq's
callback to be called with NULL data.
Prevent this by executing the callback with locks and a check
NULL data in the callback.

Change-Id: Ibf66dcca7c6d632829f4114ea88c46be77165e6e
Signed-off-by: default avatarAbhilash Kumar <krabhi@codeaurora.org>
parent 263b6f0d
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -354,9 +354,11 @@ irqreturn_t cam_a5_irq(int irq_num, void *data)
		CAM_ERR_RATE_LIMIT(CAM_ICP, "watch dog interrupt from A5");
	}

	spin_lock(&a5_dev->hw_lock);
	if (core_info->irq_cb.icp_hw_mgr_cb)
		core_info->irq_cb.icp_hw_mgr_cb(irq_status,
					core_info->irq_cb.data);
	spin_unlock(&a5_dev->hw_lock);

	return IRQ_HANDLED;
}
@@ -414,8 +416,10 @@ int cam_a5_process_cmd(void *device_priv, uint32_t cmd_type,
			return -EINVAL;
		}

		spin_lock(&a5_dev->hw_lock);
		core_info->irq_cb.icp_hw_mgr_cb = irq_cb->icp_hw_mgr_cb;
		core_info->irq_cb.data = irq_cb->data;
		spin_unlock(&a5_dev->hw_lock);
		break;
	}

+5 −0
Original line number Diff line number Diff line
@@ -2001,6 +2001,11 @@ int32_t cam_icp_hw_mgr_cb(uint32_t irq_status, void *data)
	struct crm_workq_task *task;
	struct hfi_msg_work_data *task_data;

	if (!data) {
		CAM_ERR(CAM_ICP, "irq cb data is NULL");
		return rc;
	}

	spin_lock_irqsave(&hw_mgr->hw_mgr_lock, flags);
	task = cam_req_mgr_workq_get_task(icp_hw_mgr.msg_work);
	if (!task) {