fix: unify fallthrough annotations

Compiling with -Wimplicit-fallthrough=3 (enabled by -Wextra) produces
many warnings about fallthrough comments either missing or being wrong.
Unify the comments so we comply with -Wextra.

Note that Coverity recommends against using the __attribute__ directive.
Also, zlib does not build with a higher value of -Wimplicit-fallthrough.
Finally, compilers strip comments before expanding macros. As such,
checkpatch's fallthrough annotation (or higher levels of the flag) isn't
really possible.

Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
Change-Id: I060cf4f8dc04c02cbb45cf4ceb69569a8369ccee
This commit is contained in:
Boyan Karatotev 2022-11-18 14:17:17 +00:00
parent d3d2a5a484
commit e138400d1c
6 changed files with 15 additions and 10 deletions

View file

@ -136,7 +136,8 @@ static int imx_usdhc_send_cmd(struct mmc_cmd *cmd)
break; break;
case MMC_CMD(18): case MMC_CMD(18):
multiple = 1; multiple = 1;
/* fall thru for read op */ /* for read op */
/* fallthrough */
case MMC_CMD(17): case MMC_CMD(17):
case MMC_CMD(8): case MMC_CMD(8):
mixctl |= MIXCTRL_DTDSEL; mixctl |= MIXCTRL_DTDSEL;
@ -144,7 +145,8 @@ static int imx_usdhc_send_cmd(struct mmc_cmd *cmd)
break; break;
case MMC_CMD(25): case MMC_CMD(25):
multiple = 1; multiple = 1;
/* fall thru for data op flag */ /* for data op flag */
/* fallthrough */
case MMC_CMD(24): case MMC_CMD(24):
data = 1; data = 1;
break; break;

View file

@ -254,8 +254,7 @@ EMMC_ERROR_CODE emmc_exec_cmd(uint32_t error_mask, uint32_t *response)
(SD_INFO2_ALL_ERR | SD_INFO2_CLEAR)); (SD_INFO2_ALL_ERR | SD_INFO2_CLEAR));
state = ESTATE_ISSUE_CMD; state = ESTATE_ISSUE_CMD;
/* through */ /* fallthrough */
case ESTATE_ISSUE_CMD: case ESTATE_ISSUE_CMD:
/* ARG */ /* ARG */
SETR_32(SD_ARG, mmc_drv_obj.cmd_info.arg); SETR_32(SD_ARG, mmc_drv_obj.cmd_info.arg);
@ -454,8 +453,8 @@ EMMC_ERROR_CODE emmc_exec_cmd(uint32_t error_mask, uint32_t *response)
SETR_32(SD_STOP, 0x00000000U); SETR_32(SD_STOP, 0x00000000U);
mmc_drv_obj.during_dma_transfer = FALSE; mmc_drv_obj.during_dma_transfer = FALSE;
} }
/* through */
/* fallthrough */
case ESTATE_ERROR: case ESTATE_ERROR:
if (err_not_care_flag == TRUE) { if (err_not_care_flag == TRUE) {
mmc_drv_obj.during_cmd_processing = FALSE; mmc_drv_obj.during_cmd_processing = FALSE;

View file

@ -209,6 +209,7 @@ loop:
break; break;
case 'X': case 'X':
capitalise = true; capitalise = true;
/* fallthrough */
case 'x': case 'x':
unum = get_unum_va_args(args, l_count); unum = get_unum_va_args(args, l_count);
unsigned_num_print(&s, n, &chars_printed, unsigned_num_print(&s, n, &chars_printed,

View file

@ -51,6 +51,7 @@
x3 = x3 & MASK_32_BIT; \ x3 = x3 & MASK_32_BIT; \
x4 = x4 & MASK_32_BIT; \ x4 = x4 & MASK_32_BIT; \
} \ } \
/* fallthrough */ \
case _smc_id##_AARCH64: \ case _smc_id##_AARCH64: \
{ \ { \
if (_smc_id##_descriptor_index < 0) { \ if (_smc_id##_descriptor_index < 0) { \

View file

@ -350,7 +350,7 @@ static int _pwr_state_validate(uint32_t pwr_state,
else if (SOC_SYSTEM_STANDBY) else if (SOC_SYSTEM_STANDBY)
state->pwr_domain_state[PLAT_MAX_LVL] = state->pwr_domain_state[PLAT_MAX_LVL] =
PLAT_MAX_RET_STATE; PLAT_MAX_RET_STATE;
/* intentional fall-thru condition */ /* fallthrough */
case PWR_STATE_LVL_SYS: case PWR_STATE_LVL_SYS:
if (pwrdn && SOC_SYSTEM_PWR_DWN) if (pwrdn && SOC_SYSTEM_PWR_DWN)
state->pwr_domain_state[PLAT_SYS_LVL] = state->pwr_domain_state[PLAT_SYS_LVL] =
@ -358,7 +358,7 @@ static int _pwr_state_validate(uint32_t pwr_state,
else if (SOC_SYSTEM_STANDBY) else if (SOC_SYSTEM_STANDBY)
state->pwr_domain_state[PLAT_SYS_LVL] = state->pwr_domain_state[PLAT_SYS_LVL] =
PLAT_MAX_RET_STATE; PLAT_MAX_RET_STATE;
/* intentional fall-thru condition */ /* fallthrough */
case PWR_STATE_LVL_CLSTR: case PWR_STATE_LVL_CLSTR:
if (pwrdn && SOC_CLUSTER_PWR_DWN) if (pwrdn && SOC_CLUSTER_PWR_DWN)
state->pwr_domain_state[PLAT_CLSTR_LVL] = state->pwr_domain_state[PLAT_CLSTR_LVL] =
@ -366,7 +366,7 @@ static int _pwr_state_validate(uint32_t pwr_state,
else if (SOC_CLUSTER_STANDBY) else if (SOC_CLUSTER_STANDBY)
state->pwr_domain_state[PLAT_CLSTR_LVL] = state->pwr_domain_state[PLAT_CLSTR_LVL] =
PLAT_MAX_RET_STATE; PLAT_MAX_RET_STATE;
/* intentional fall-thru condition */ /* fallthrough */
case PWR_STATE_LVL_CORE: case PWR_STATE_LVL_CORE:
stat = PSCI_E_SUCCESS; stat = PSCI_E_SUCCESS;

View file

@ -868,7 +868,8 @@ uint64_t spmd_smc_handler(uint32_t smc_fid,
FFA_ERROR_NOT_SUPPORTED); FFA_ERROR_NOT_SUPPORTED);
} }
/* Fall through to forward the call to the other world */ /* Forward the call to the other world */
/* fallthrough */
case FFA_MSG_SEND: case FFA_MSG_SEND:
case FFA_MSG_SEND_DIRECT_RESP_SMC64: case FFA_MSG_SEND_DIRECT_RESP_SMC64:
case FFA_MEM_DONATE_SMC32: case FFA_MEM_DONATE_SMC32:
@ -908,7 +909,8 @@ uint64_t spmd_smc_handler(uint32_t smc_fid,
spmd_spm_core_sync_exit(0ULL); spmd_spm_core_sync_exit(0ULL);
} }
/* Fall through to forward the call to the other world */ /* Forward the call to the other world */
/* fallthrough */
case FFA_INTERRUPT: case FFA_INTERRUPT:
case FFA_MSG_YIELD: case FFA_MSG_YIELD:
/* This interface must be invoked only by the Secure world */ /* This interface must be invoked only by the Secure world */