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

Commit 1ed6c5c6 authored by Camera Software Integration's avatar Camera Software Integration Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: ope: Add context state check in process cmd" into camera-kernel.lnx.3.1

parents 4740996f db9d8b9b
Loading
Loading
Loading
Loading
+16 −4
Original line number Diff line number Diff line
@@ -96,12 +96,19 @@ static int cam_ope_mgr_process_cmd(void *priv, void *data)
	task_data = (struct ope_cmd_work_data *)data;
	cdm_cmd = task_data->data;

	CAM_DBG(CAM_OPE,
		"cam_cdm_submit_bls: handle 0x%x, ctx_id %d req %d cookie %d",
		ctx_data->ope_cdm.cdm_handle, ctx_data->ctx_id,
		task_data->req_id, cdm_cmd->cookie);
	if (!cdm_cmd) {
		CAM_ERR(CAM_OPE, "Invalid params%pK", cdm_cmd);
		return -EINVAL;
	}

	mutex_lock(&hw_mgr->hw_mgr_mutex);
	if (ctx_data->ctx_state != OPE_CTX_STATE_ACQUIRED) {
		mutex_unlock(&hw_mgr->hw_mgr_mutex);
		CAM_ERR(CAM_OPE, "ctx id :%u is not in use",
			ctx_data->ctx_id);
		return -EINVAL;
	}

	if (task_data->req_id <= ctx_data->last_flush_req) {
		CAM_WARN(CAM_OPE,
			"request %lld has been flushed, reject packet",
@@ -110,6 +117,11 @@ static int cam_ope_mgr_process_cmd(void *priv, void *data)
		return -EINVAL;
	}

	CAM_DBG(CAM_OPE,
		"cam_cdm_submit_bls: handle 0x%x, ctx_id %d req %d cookie %d",
		ctx_data->ope_cdm.cdm_handle, ctx_data->ctx_id,
		task_data->req_id, cdm_cmd->cookie);

	if (task_data->req_id > ctx_data->last_flush_req)
		ctx_data->last_flush_req = 0;