services: fix switch statements to comply with MISRA rules

Ensure (where possible) that switch statements in services comply with
MISRA rules 16.1 - 16.7.

Change-Id: I47bf6ed4a026201e6fe125ce51842482e99e8bb0
Signed-off-by: Jonathan Wright <jonathan.wright@arm.com>
This commit is contained in:
Jonathan Wright 2018-03-14 15:56:21 +00:00
parent 649c48f5dc
commit 185a23ffa3
5 changed files with 9 additions and 20 deletions

View File

@ -311,6 +311,7 @@ uint64_t opteed_smc_handler(uint32_t smc_fid,
* OPTEE. Jump back to the original C runtime context.
*/
opteed_synchronous_sp_exit(optee_ctx, x1);
break;
/*
@ -345,6 +346,7 @@ uint64_t opteed_smc_handler(uint32_t smc_fid,
* return value to the caller
*/
opteed_synchronous_sp_exit(optee_ctx, x1);
break;
/*
* OPTEE is returning from a call or being preempted from a call, in

View File

@ -49,6 +49,7 @@ uint64_t tlkd_va_translate(uintptr_t va, int type)
break;
default:
assert(0);
break;
}
/* get the (NS/S) physical address */

View File

@ -350,6 +350,7 @@ uint64_t tlkd_smc_handler(uint32_t smc_fid,
* context.
*/
tlkd_synchronous_sp_exit(&tlk_ctx, x1);
break;
/*
* These function IDs are used only by TLK to indicate it has
@ -375,6 +376,7 @@ uint64_t tlkd_smc_handler(uint32_t smc_fid,
* return value to the caller
*/
tlkd_synchronous_sp_exit(&tlk_ctx, x1);
break;
/*
* Return the number of service function IDs implemented to

View File

@ -435,6 +435,7 @@ uint64_t tspd_smc_handler(uint32_t smc_fid,
* context.
*/
tspd_synchronous_sp_exit(tsp_ctx, x1);
break;
#endif
/*
* This function ID is used only by the SP to indicate it has finished
@ -475,6 +476,7 @@ uint64_t tspd_smc_handler(uint32_t smc_fid,
* return value to the caller
*/
tspd_synchronous_sp_exit(tsp_ctx, x1);
break;
/*
* Request from non-secure client to perform an
@ -591,7 +593,6 @@ uint64_t tspd_smc_handler(uint32_t smc_fid,
SMC_RET3(ns_cpu_context, x1, x2, x3);
}
break;
/*
* Request from the non-secure world to abort a preempted Yielding SMC
* Call.

View File

@ -916,7 +916,6 @@ uint64_t sdei_smc_handler(uint32_t smc_fid,
ret = sdei_version();
SDEI_LOG("< VER:%lx\n", ret);
SMC_RET1(handle, ret);
break;
case SDEI_EVENT_REGISTER:
x5 = SMC_GET_GP(handle, CTX_GPREG_X5);
@ -925,32 +924,27 @@ uint64_t sdei_smc_handler(uint32_t smc_fid,
ret = sdei_event_register(x1, x2, x3, x4, x5);
SDEI_LOG("< REG:%ld\n", ret);
SMC_RET1(handle, ret);
break;
case SDEI_EVENT_ENABLE:
SDEI_LOG("> ENABLE(n:%d)\n", (int) x1);
ret = sdei_event_enable(x1);
SDEI_LOG("< ENABLE:%ld\n", ret);
SMC_RET1(handle, ret);
break;
case SDEI_EVENT_DISABLE:
SDEI_LOG("> DISABLE(n:%d)\n", (int) x1);
ret = sdei_event_disable(x1);
SDEI_LOG("< DISABLE:%ld\n", ret);
SMC_RET1(handle, ret);
break;
case SDEI_EVENT_CONTEXT:
SDEI_LOG("> CTX(p:%d):%lx\n", (int) x1, read_mpidr_el1());
ret = sdei_event_context(handle, x1);
SDEI_LOG("< CTX:%ld\n", ret);
SMC_RET1(handle, ret);
break;
case SDEI_EVENT_COMPLETE_AND_RESUME:
resume = 1;
/* Fall through */
case SDEI_EVENT_COMPLETE:
SDEI_LOG("> COMPLETE(r:%d sta/ep:%lx):%lx\n", resume, x1,
@ -969,92 +963,81 @@ uint64_t sdei_smc_handler(uint32_t smc_fid,
SMC_RET1(handle, ret);
SMC_RET0(handle);
break;
case SDEI_EVENT_STATUS:
SDEI_LOG("> STAT(n:%d)\n", (int) x1);
ret = sdei_event_status(x1);
SDEI_LOG("< STAT:%ld\n", ret);
SMC_RET1(handle, ret);
break;
case SDEI_EVENT_GET_INFO:
SDEI_LOG("> INFO(n:%d, %d)\n", (int) x1, (int) x2);
ret = sdei_event_get_info(x1, x2);
SDEI_LOG("< INFO:%ld\n", ret);
SMC_RET1(handle, ret);
break;
case SDEI_EVENT_UNREGISTER:
SDEI_LOG("> UNREG(n:%d)\n", (int) x1);
ret = sdei_event_unregister(x1);
SDEI_LOG("< UNREG:%ld\n", ret);
SMC_RET1(handle, ret);
break;
case SDEI_PE_UNMASK:
SDEI_LOG("> UNMASK:%lx\n", read_mpidr_el1());
sdei_pe_unmask();
SDEI_LOG("< UNMASK:%d\n", 0);
SMC_RET1(handle, 0);
break;
case SDEI_PE_MASK:
SDEI_LOG("> MASK:%lx\n", read_mpidr_el1());
ret = sdei_pe_mask();
SDEI_LOG("< MASK:%ld\n", ret);
SMC_RET1(handle, ret);
break;
case SDEI_INTERRUPT_BIND:
SDEI_LOG("> BIND(%d)\n", (int) x1);
ret = sdei_interrupt_bind(x1);
SDEI_LOG("< BIND:%ld\n", ret);
SMC_RET1(handle, ret);
break;
case SDEI_INTERRUPT_RELEASE:
SDEI_LOG("> REL(%d)\n", (int) x1);
ret = sdei_interrupt_release(x1);
SDEI_LOG("< REL:%ld\n", ret);
SMC_RET1(handle, ret);
break;
case SDEI_SHARED_RESET:
SDEI_LOG("> S_RESET():%lx\n", read_mpidr_el1());
ret = sdei_shared_reset();
SDEI_LOG("< S_RESET:%ld\n", ret);
SMC_RET1(handle, ret);
break;
case SDEI_PRIVATE_RESET:
SDEI_LOG("> P_RESET():%lx\n", read_mpidr_el1());
ret = sdei_private_reset();
SDEI_LOG("< P_RESET:%ld\n", ret);
SMC_RET1(handle, ret);
break;
case SDEI_EVENT_ROUTING_SET:
SDEI_LOG("> ROUTE_SET(n:%d f:%lx aff:%lx)\n", (int) x1, x2, x3);
ret = sdei_event_routing_set(x1, x2, x3);
SDEI_LOG("< ROUTE_SET:%ld\n", ret);
SMC_RET1(handle, ret);
break;
case SDEI_FEATURES:
SDEI_LOG("> FTRS(f:%lx)\n", x1);
ret = sdei_features(x1);
SDEI_LOG("< FTRS:%lx\n", ret);
SMC_RET1(handle, ret);
break;
case SDEI_EVENT_SIGNAL:
SDEI_LOG("> SIGNAL(e:%lx t:%lx)\n", x1, x2);
ret = sdei_signal(x1, x2);
SDEI_LOG("< SIGNAL:%ld\n", ret);
SMC_RET1(handle, ret);
break;
default:
/* Do nothing in default case */
break;
}