aboutsummaryrefslogtreecommitdiff
path: root/services/spd
diff options
context:
space:
mode:
authorDaniel Boulby <daniel.boulby@arm.com>2018-06-22 14:16:03 +0100
committerDaniel Boulby <daniel.boulby@arm.com>2018-09-21 13:14:13 +0100
commita08a2014300a495381cdb8f6d59523bcd5d3b883 (patch)
treeab016b027c303ccbe8001764f824f8980b233f54 /services/spd
parente52ed092cde21d13533df32eb68629a980d69b4b (diff)
downloadtrusted-firmware-a-a08a2014300a495381cdb8f6d59523bcd5d3b883.tar.gz
Ensure the flow through switch statements is clear
Ensure case clauses: * Terminate with an unconditional break, return or goto statement. * Use conditional break, return or goto statements as long as the end of the case clause is unreachable; such case clauses must terminate with assert(0) /* Unreachable */ or an unconditional __dead2 function call * Only fallthough when doing otherwise would result in less readable/maintainable code; such case clauses must terminate with a /* Fallthrough */ comment to make it clear this is the case and indicate that a fallthrough is intended. This reduces the chance of bugs appearing due to unintended flow through a switch statement Change-Id: I70fc2d1f4fd679042397dec12fd1982976646168 Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
Diffstat (limited to 'services/spd')
-rw-r--r--services/spd/tlkd/tlkd_common.c4
-rw-r--r--services/spd/tspd/tspd_main.c1
2 files changed, 3 insertions, 2 deletions
diff --git a/services/spd/tlkd/tlkd_common.c b/services/spd/tlkd/tlkd_common.c
index d846269b96..6fec91bca7 100644
--- a/services/spd/tlkd/tlkd_common.c
+++ b/services/spd/tlkd/tlkd_common.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -48,7 +48,7 @@ uint64_t tlkd_va_translate(uintptr_t va, int type)
ats12e0w(va);
break;
default:
- assert(0);
+ assert(0); /* Unreachable */
break;
}
diff --git a/services/spd/tspd/tspd_main.c b/services/spd/tspd/tspd_main.c
index 3ec98d6875..d2acda8d9e 100644
--- a/services/spd/tspd/tspd_main.c
+++ b/services/spd/tspd/tspd_main.c
@@ -592,6 +592,7 @@ static uintptr_t tspd_smc_handler(uint32_t smc_fid,
SMC_RET3(ns_cpu_context, x1, x2, x3);
}
+ assert(0); /* Unreachable */
/*
* Request from the non-secure world to abort a preempted Yielding SMC