summaryrefslogtreecommitdiff
path: root/bl31/context_mgmt.c
diff options
context:
space:
mode:
authorJuan Castillo <juan.castillo@arm.com>2014-06-05 09:45:36 +0100
committerJuan Castillo <juan.castillo@arm.com>2014-07-28 12:20:16 +0100
commitd3280beb700321b0ef47b4f61d84667ba501bc61 (patch)
tree8a6c3f70a6f8d289256ac3fb940ea07a339072a1 /bl31/context_mgmt.c
parent592dd7cbe658cc33ae2818c9ed543ac57e97f784 (diff)
Rework incorrect use of assert() and panic() in codebase
Assert a valid security state using the macro sec_state_is_valid(). Replace assert() with panic() in those cases that might arise because of runtime errors and not programming errors. Replace panic() with assert() in those cases that might arise because of programming errors. Fixes ARM-software/tf-issues#96 Change-Id: I51e9ef0439fd5ff5e0edfef49050b69804bf14d5
Diffstat (limited to 'bl31/context_mgmt.c')
-rw-r--r--bl31/context_mgmt.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/bl31/context_mgmt.c b/bl31/context_mgmt.c
index 65f12137..4502e5dc 100644
--- a/bl31/context_mgmt.c
+++ b/bl31/context_mgmt.c
@@ -71,7 +71,7 @@ void cm_init(void)
******************************************************************************/
void *cm_get_context_by_mpidr(uint64_t mpidr, uint32_t security_state)
{
- assert(security_state <= NON_SECURE);
+ assert(sec_state_is_valid(security_state));
return get_cpu_data_by_mpidr(mpidr, cpu_context[security_state]);
}
@@ -82,7 +82,7 @@ void *cm_get_context_by_mpidr(uint64_t mpidr, uint32_t security_state)
******************************************************************************/
void cm_set_context_by_mpidr(uint64_t mpidr, void *context, uint32_t security_state)
{
- assert(security_state <= NON_SECURE);
+ assert(sec_state_is_valid(security_state));
set_cpu_data_by_mpidr(mpidr, cpu_context[security_state], context);
}