From a08a2014300a495381cdb8f6d59523bcd5d3b883 Mon Sep 17 00:00:00 2001 From: Daniel Boulby Date: Fri, 22 Jun 2018 14:16:03 +0100 Subject: 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 --- bl1/bl1_fwu.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'bl1') diff --git a/bl1/bl1_fwu.c b/bl1/bl1_fwu.c index 25be5770..28b9eb90 100644 --- a/bl1/bl1_fwu.c +++ b/bl1/bl1_fwu.c @@ -86,11 +86,9 @@ register_t bl1_fwu_smc_handler(unsigned int smc_fid, case FWU_SMC_UPDATE_DONE: bl1_fwu_done((void *)x1, NULL); - /* We should never return from bl1_fwu_done() */ - break; default: - assert(0); + assert(0); /* Unreachable */ break; } @@ -747,7 +745,7 @@ static int bl1_fwu_image_reset(unsigned int image_id, unsigned int flags) case IMAGE_STATE_EXECUTED: default: - assert(0); + assert(0); /* Unreachable */ break; } -- cgit v1.2.3