Commit 3eacacc0 authored by Jonathan Wright's avatar Jonathan Wright
Browse files

lib: fix switch statements to comply with MISRA rules



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

Change-Id: I52bc896fb7094d2b7569285686ee89f39f1ddd84
Signed-off-by: default avatarJonathan Wright <jonathan.wright@arm.com>
parent 5aa7498a
...@@ -37,8 +37,8 @@ ...@@ -37,8 +37,8 @@
/* /*
* Defines for PMF SMC function ids. * Defines for PMF SMC function ids.
*/ */
#define PMF_SMC_GET_TIMESTAMP_32 0x82000010 #define PMF_SMC_GET_TIMESTAMP_32 0x82000010u
#define PMF_SMC_GET_TIMESTAMP_64 0xC2000010 #define PMF_SMC_GET_TIMESTAMP_64 0xC2000010u
#define PMF_NUM_SMC_CALLS 2 #define PMF_NUM_SMC_CALLS 2
/* /*
......
...@@ -30,8 +30,7 @@ uintptr_t pmf_smc_handler(unsigned int smc_fid, ...@@ -30,8 +30,7 @@ uintptr_t pmf_smc_handler(unsigned int smc_fid,
x2 = (uint32_t)x2; x2 = (uint32_t)x2;
x3 = (uint32_t)x3; x3 = (uint32_t)x3;
switch (smc_fid) { if (smc_fid == PMF_SMC_GET_TIMESTAMP_32) {
case PMF_SMC_GET_TIMESTAMP_32:
/* /*
* Return error code and the captured * Return error code and the captured
* time-stamp to the caller. * time-stamp to the caller.
...@@ -41,13 +40,9 @@ uintptr_t pmf_smc_handler(unsigned int smc_fid, ...@@ -41,13 +40,9 @@ uintptr_t pmf_smc_handler(unsigned int smc_fid,
rc = pmf_get_timestamp_smc(x1, x2, x3, &ts_value); rc = pmf_get_timestamp_smc(x1, x2, x3, &ts_value);
SMC_RET3(handle, rc, (uint32_t)ts_value, SMC_RET3(handle, rc, (uint32_t)ts_value,
(uint32_t)(ts_value >> 32)); (uint32_t)(ts_value >> 32));
default:
break;
} }
} else { } else {
switch (smc_fid) { if (smc_fid == PMF_SMC_GET_TIMESTAMP_64) {
case PMF_SMC_GET_TIMESTAMP_64:
/* /*
* Return error code and the captured * Return error code and the captured
* time-stamp to the caller. * time-stamp to the caller.
...@@ -56,9 +51,6 @@ uintptr_t pmf_smc_handler(unsigned int smc_fid, ...@@ -56,9 +51,6 @@ uintptr_t pmf_smc_handler(unsigned int smc_fid,
*/ */
rc = pmf_get_timestamp_smc(x1, x2, x3, &ts_value); rc = pmf_get_timestamp_smc(x1, x2, x3, &ts_value);
SMC_RET2(handle, rc, ts_value); SMC_RET2(handle, rc, ts_value);
default:
break;
} }
} }
......
...@@ -414,10 +414,12 @@ u_register_t psci_smc_handler(uint32_t smc_fid, ...@@ -414,10 +414,12 @@ u_register_t psci_smc_handler(uint32_t smc_fid,
case PSCI_SYSTEM_OFF: case PSCI_SYSTEM_OFF:
psci_system_off(); psci_system_off();
/* We should never return from psci_system_off() */ /* We should never return from psci_system_off() */
break;
case PSCI_SYSTEM_RESET: case PSCI_SYSTEM_RESET:
psci_system_reset(); psci_system_reset();
/* We should never return from psci_system_reset() */ /* We should never return from psci_system_reset() */
break;
case PSCI_FEATURES: case PSCI_FEATURES:
return psci_features(x1); return psci_features(x1);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment