mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-16 09:34:18 +00:00
fix(st): explicitly check operators precedence
This corrects the MISRA violation C2012-12.1: The precedence of operators within expressions should be made explicit. This is done either by adding parentheses, or by creating dedicated variables to ease readability. Signed-off-by: Yann Gautier <yann.gautier@st.com> Change-Id: I5e3f191ee38eca7ef634bd7542e615ab625271f6
This commit is contained in:
parent
825641d615
commit
56048fe215
4 changed files with 15 additions and 12 deletions
|
@ -416,7 +416,7 @@ int fdt_get_gpio_bank_pin_count(unsigned int bank)
|
|||
|
||||
/* Get the last defined gpio line (offset + nb of pins) */
|
||||
pin_count = fdt32_to_cpu(*(cuint + 1)) + fdt32_to_cpu(*(cuint + 3));
|
||||
for (i = 0; i < len / 4; i++) {
|
||||
for (i = 0; i < (len / 4); i++) {
|
||||
pin_count = MAX(pin_count, (int)(fdt32_to_cpu(*(cuint + 1)) +
|
||||
fdt32_to_cpu(*(cuint + 3))));
|
||||
cuint += 4;
|
||||
|
|
|
@ -99,15 +99,16 @@ static int fconf_populate_stm32mp1_firewall(uintptr_t config)
|
|||
|
||||
/* Locate the memory cells and read all values */
|
||||
for (i = 0U; i < (unsigned int)(len / (sizeof(uint32_t) * STM32MP_REGION_PARAMS)); i++) {
|
||||
uint32_t idx = i * STM32MP_REGION_PARAMS;
|
||||
uint32_t base;
|
||||
uint32_t size;
|
||||
uint32_t sec_attr;
|
||||
uint32_t nsaid;
|
||||
|
||||
base = fdt32_to_cpu(conf_list->id_attr[i * STM32MP_REGION_PARAMS]);
|
||||
size = fdt32_to_cpu(conf_list->id_attr[i * STM32MP_REGION_PARAMS + 1]);
|
||||
sec_attr = fdt32_to_cpu(conf_list->id_attr[i * STM32MP_REGION_PARAMS + 2]);
|
||||
nsaid = fdt32_to_cpu(conf_list->id_attr[i * STM32MP_REGION_PARAMS + 3]);
|
||||
base = fdt32_to_cpu(conf_list->id_attr[idx]);
|
||||
size = fdt32_to_cpu(conf_list->id_attr[idx + 1]);
|
||||
sec_attr = fdt32_to_cpu(conf_list->id_attr[idx + 2]);
|
||||
nsaid = fdt32_to_cpu(conf_list->id_attr[idx + 3]);
|
||||
|
||||
VERBOSE("FCONF: stm32mp1-firewall cell found with value = 0x%x 0x%x 0x%x 0x%x\n",
|
||||
base, size, sec_attr, nsaid);
|
||||
|
|
|
@ -140,14 +140,14 @@ void configure_mmu(void)
|
|||
uintptr_t stm32_get_gpio_bank_base(unsigned int bank)
|
||||
{
|
||||
#if STM32MP13
|
||||
assert(GPIO_BANK_A == 0 && bank <= GPIO_BANK_I);
|
||||
assert((GPIO_BANK_A == 0) && (bank <= GPIO_BANK_I));
|
||||
#endif
|
||||
#if STM32MP15
|
||||
if (bank == GPIO_BANK_Z) {
|
||||
return GPIOZ_BASE;
|
||||
}
|
||||
|
||||
assert(GPIO_BANK_A == 0 && bank <= GPIO_BANK_K);
|
||||
assert((GPIO_BANK_A == 0) && (bank <= GPIO_BANK_K));
|
||||
#endif
|
||||
|
||||
return GPIOA_BASE + (bank * GPIO_BANK_OFFSET);
|
||||
|
@ -156,14 +156,14 @@ uintptr_t stm32_get_gpio_bank_base(unsigned int bank)
|
|||
uint32_t stm32_get_gpio_bank_offset(unsigned int bank)
|
||||
{
|
||||
#if STM32MP13
|
||||
assert(GPIO_BANK_A == 0 && bank <= GPIO_BANK_I);
|
||||
assert((GPIO_BANK_A == 0) && (bank <= GPIO_BANK_I));
|
||||
#endif
|
||||
#if STM32MP15
|
||||
if (bank == GPIO_BANK_Z) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
assert(GPIO_BANK_A == 0 && bank <= GPIO_BANK_K);
|
||||
assert((GPIO_BANK_A == 0) && (bank <= GPIO_BANK_K));
|
||||
#endif
|
||||
|
||||
return bank * GPIO_BANK_OFFSET;
|
||||
|
@ -186,14 +186,14 @@ bool stm32_gpio_is_secure_at_reset(unsigned int bank)
|
|||
unsigned long stm32_get_gpio_bank_clock(unsigned int bank)
|
||||
{
|
||||
#if STM32MP13
|
||||
assert(GPIO_BANK_A == 0 && bank <= GPIO_BANK_I);
|
||||
assert((GPIO_BANK_A == 0) && (bank <= GPIO_BANK_I));
|
||||
#endif
|
||||
#if STM32MP15
|
||||
if (bank == GPIO_BANK_Z) {
|
||||
return GPIOZ;
|
||||
}
|
||||
|
||||
assert(GPIO_BANK_A == 0 && bank <= GPIO_BANK_K);
|
||||
assert((GPIO_BANK_A == 0) && (bank <= GPIO_BANK_K));
|
||||
#endif
|
||||
|
||||
return GPIOA + (bank - GPIO_BANK_A);
|
||||
|
|
|
@ -235,7 +235,9 @@ static void enable_hslv_by_index(uint32_t index)
|
|||
}
|
||||
|
||||
if (apply_hslv) {
|
||||
mmio_write_32(SYSCFG_BASE + SYSCFG_HSLVEN0R + index * sizeof(uint32_t), HSLV_KEY);
|
||||
uint32_t reg_offset = index * sizeof(uint32_t);
|
||||
|
||||
mmio_write_32(SYSCFG_BASE + SYSCFG_HSLVEN0R + reg_offset, HSLV_KEY);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue