[FOSS_TLK]tegra: common: Add checks for ns_vfp_hw_context
If any task is not loaded then this will be NULL.
Hence adding checks before accessing.
Change-Id: I41fdaebb3124581823f8a064d38621b503be0c7c
Signed-off-by: Sharif Inamdar <isharif@nvidia.com>
Reviewed-on: http://git-master/r/715783
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>
Tested-by: Varun Wadekar <vwadekar@nvidia.com>
diff --git a/platform/tegra/common/tz.c b/platform/tegra/common/tz.c
index 98c1392..fefb287 100644
--- a/platform/tegra/common/tz.c
+++ b/platform/tegra/common/tz.c
@@ -187,10 +187,9 @@
*/
arch_vfp_restore(ns_vfp_hw_context);
ns_vfp_hw_context->valid = false;
+ arm_set_vfp_fpexc(ns_vfp_hw_context->fpexc);
}
- arm_set_vfp_fpexc(ns_vfp_hw_context->fpexc);
-
#if defined(WITH_MONITOR_BIN)
/* go to monitor, for return to NS */
incoming_smc = monitor_send_receive(smc_type, frame);
@@ -202,9 +201,12 @@
exit_critical_section();
/* on entry, save NS fpexc and disable to detect vfp usage */
- ns_vfp_hw_context->fpexc = arm_get_vfp_fpexc();
+ if (ns_vfp_hw_context && ns_vfp_hw_context->valid)
+ ns_vfp_hw_context->fpexc = arm_get_vfp_fpexc();
+
arm_set_vfp_fpexc(0x0);
+
return incoming_smc;
}