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

Commit a10bbc96 authored by Ram Chandrasekar's avatar Ram Chandrasekar
Browse files

msm: lmh_lite: Add memory barrier before reading data from trustzone



Add memory barrier before reading data from trustzone
to make sure LMH driver doesnt fails because of
reading the data in out of order execution.

CRs-Fixed: 759855
Change-Id: Id2e917bf8100fc2f775186d8db630a39089337a2
Signed-off-by: default avatarRam Chandrasekar <rkumbako@codeaurora.org>
parent f1a9f6d4
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -230,6 +230,8 @@ static void lmh_read_and_update(struct lmh_driver_data *lmh_dat)
	else
		ret = scm_call2(SCM_SIP_FNID(SCM_SVC_LMH,
			LMH_GET_INTENSITY), &desc_arg);
	/* Have memory barrier before we access the TZ data */
	mb();
	if (ret) {
		pr_err("Error in SCM v%d read call. err:%d\n",
				(is_scm_armv8()) ? 8 : 7, ret);
@@ -526,6 +528,8 @@ static int lmh_get_sensor_list(void)
		else
			ret = scm_call2(SCM_SIP_FNID(SCM_SVC_LMH,
				LMH_GET_SENSORS), &desc_arg);
		/* Have memory barrier before we access the TZ data */
		mb();
		if (ret < 0) {
			pr_err("Error in SCM v%d call. err:%d\n",
					(is_scm_armv8()) ? 8 : 7, ret);
@@ -661,6 +665,8 @@ static int lmh_get_dev_info(void)
				LMH_GET_PROFILES), &desc_arg);
			size = desc_arg.ret[0];
		}
		/* Have memory barrier before we access the TZ data */
		mb();
		if (ret) {
			pr_err("Error in SCM v%d get Profile call. err:%d\n",
					(is_scm_armv8()) ? 8 : 7, ret);