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

Commit db9d8b9b authored by Alok Chauhan's avatar Alok Chauhan
Browse files

msm: camera: ope: Add context state check in process cmd



There is chance that release hw run before process cmd workq
which got scheduled as part of config hw. This causes workq
to continue the context though it got released as part of
release hw.

Added a context state check in process cmd workq handler to
avoid submitting request to cdm hardware.

CRs-Fixed: 2670524
Change-Id: I7009d4b60bd97b9f6d46df51790c127a2cf18205
Signed-off-by: default avatarAlok Chauhan <alokc@codeaurora.org>
parent 7ce0928a
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;