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

Commit cfd1e203 authored by Michael Adisumarta's avatar Michael Adisumarta
Browse files

msm: ipa: Mutex protect state variable



This fix mutex protects a IPA MHI manager state variable
for synchronization.

Change-Id: I107226467668466f0c020ada65888a9641dac4c7
Acked-by: default avatarJyothi Jayanthi <jyothij@qti.qualcomm.com>
Signed-off-by: default avatarMichael Adisumarta <madisuma@codeaurora.org>
parent 4719c01d
Loading
Loading
Loading
Loading
+5 −2
Original line number Original line Diff line number Diff line
@@ -477,12 +477,15 @@ struct ipa_mhi_alloc_channel_resp_msg_v01 *imp_handle_allocate_channel_req(


	IMP_FUNC_ENTRY();
	IMP_FUNC_ENTRY();


	mutex_lock(&imp_ctx->mutex);

	memset(resp, 0, sizeof(*resp));
	memset(resp, 0, sizeof(*resp));


	if (imp_ctx->state != IMP_READY) {
	if (imp_ctx->state != IMP_READY) {
		IMP_ERR("invalid state %d\n", imp_ctx->state);
		IMP_ERR("invalid state %d\n", imp_ctx->state);
		resp->resp.result = IPA_QMI_RESULT_FAILURE_V01;
		resp->resp.result = IPA_QMI_RESULT_FAILURE_V01;
		resp->resp.error = IPA_QMI_ERR_INCOMPATIBLE_STATE_V01;
		resp->resp.error = IPA_QMI_ERR_INCOMPATIBLE_STATE_V01;
		mutex_unlock(&imp_ctx->mutex);
		return resp;
		return resp;
	}
	}


@@ -493,6 +496,7 @@ struct ipa_mhi_alloc_channel_resp_msg_v01 *imp_handle_allocate_channel_req(
		IMP_ERR("invalid tr_info_arr_len %d\n", req->tr_info_arr_len);
		IMP_ERR("invalid tr_info_arr_len %d\n", req->tr_info_arr_len);
		resp->resp.result = IPA_QMI_RESULT_FAILURE_V01;
		resp->resp.result = IPA_QMI_RESULT_FAILURE_V01;
		resp->resp.error = IPA_QMI_ERR_NO_MEMORY_V01;
		resp->resp.error = IPA_QMI_ERR_NO_MEMORY_V01;
		mutex_unlock(&imp_ctx->mutex);
		return resp;
		return resp;
	}
	}


@@ -502,11 +506,10 @@ struct ipa_mhi_alloc_channel_resp_msg_v01 *imp_handle_allocate_channel_req(
		IMP_ERR("no mapping provided, but smmu is enabled\n");
		IMP_ERR("no mapping provided, but smmu is enabled\n");
		resp->resp.result = IPA_QMI_RESULT_FAILURE_V01;
		resp->resp.result = IPA_QMI_RESULT_FAILURE_V01;
		resp->resp.error = IPA_QMI_ERR_INTERNAL_V01;
		resp->resp.error = IPA_QMI_ERR_INTERNAL_V01;
		mutex_unlock(&imp_ctx->mutex);
		return resp;
		return resp;
	}
	}


	mutex_lock(&imp_ctx->mutex);

	if (imp_ctx->dev_info.smmu_enabled) {
	if (imp_ctx->dev_info.smmu_enabled) {
		/* map CTRL */
		/* map CTRL */
		__map_smmu_info(imp_ctx->md.mhi_dev->dev.parent,
		__map_smmu_info(imp_ctx->md.mhi_dev->dev.parent,