Skip to content

Commit daae408

Browse files
ndrs-psthenrikbrixandersen
authored andcommitted
style: soc: comply with MISRA C:2012 Rule 15.6
Add missing braces to comply with MISRA C:2012 Rule 15.6 and also following Zephyr's style guideline. Signed-off-by: Pisit Sawangvonganan <[email protected]>
1 parent 7906d33 commit daae408

File tree

10 files changed

+29
-15
lines changed

10 files changed

+29
-15
lines changed

soc/aspeed/ast10x0/soc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,11 @@ void aspeed_print_abr_wdt_mode(void)
107107
/* ABR enable */
108108
if (sys_read32(HW_STRAP2_SCU510) & BIT(11)) {
109109
printk("FMC ABR: Enable");
110-
if (sys_read32(HW_STRAP2_SCU510) & BIT(12))
110+
if (sys_read32(HW_STRAP2_SCU510) & BIT(12)) {
111111
printk(", Single flash");
112-
else
112+
} else {
113113
printk(", Dual flashes");
114+
}
114115

115116
printk(", Source: %s (%d)",
116117
(sys_read32(ASPEED_FMC_WDT2_CTRL) & BIT(4)) ? "Alternate" : "Primary",

soc/intel/intel_adsp/ace/comm_widget_messages.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
*/
1717
int adsp_comm_widget_pmc_send_ipc(uint16_t banks)
1818
{
19-
if (!cw_upstream_ready())
19+
if (!cw_upstream_ready()) {
2020
return -EBUSY;
21+
}
2122

2223
uint32_t iface = FIELD_PREP(CW_PMC_IPC_OP_CODE, CW_PMC_OPC_SRAM_CONFIG) |
2324
FIELD_PREP(CW_PMC_IPC_SRAM_USED_BANKS, banks) |

soc/intel/intel_adsp/common/include/soc_util.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ static ALWAYS_INLINE void bmemcpy(void *dest, void *src, size_t bytes)
1515
volatile uint32_t *s = (uint32_t *)src;
1616

1717
sys_cache_data_invd_range(src, bytes);
18-
for (size_t i = 0; i < (bytes >> 2); i++)
18+
for (size_t i = 0; i < (bytes >> 2); i++) {
1919
d[i] = s[i];
20+
}
2021

2122
sys_cache_data_flush_range(dest, bytes);
2223
}
@@ -26,8 +27,9 @@ static ALWAYS_INLINE void bbzero(void *dest, size_t bytes)
2627
{
2728
volatile uint32_t *d = (uint32_t *)dest;
2829

29-
for (size_t i = 0; i < (bytes >> 2); i++)
30+
for (size_t i = 0; i < (bytes >> 2); i++) {
3031
d[i] = 0;
32+
}
3133

3234
sys_cache_data_flush_range(dest, bytes);
3335
}

soc/nxp/imx/imx6sx/soc.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,9 @@ static void SOC_CacheInit(void)
159159
LMEM_PSCCR = LMEM_PSCCR_INVW1_MASK | LMEM_PSCCR_INVW0_MASK;
160160
LMEM_PSCCR |= LMEM_PSCCR_GO_MASK;
161161
/* Wait until the command completes */
162-
while (LMEM_PSCCR & LMEM_PSCCR_GO_MASK)
162+
while (LMEM_PSCCR & LMEM_PSCCR_GO_MASK) {
163163
;
164+
}
164165
/* Enable system bus cache, enable write buffer */
165166
LMEM_PSCCR = (LMEM_PSCCR_ENWRBUF_MASK | LMEM_PSCCR_ENCACHE_MASK);
166167
barrier_isync_fence_full();
@@ -172,8 +173,9 @@ static void SOC_CacheInit(void)
172173
LMEM_PCCCR = LMEM_PCCCR_INVW1_MASK | LMEM_PCCCR_INVW0_MASK;
173174
LMEM_PCCCR |= LMEM_PCCCR_GO_MASK;
174175
/* Wait until the command completes */
175-
while (LMEM_PCCCR & LMEM_PCCCR_GO_MASK)
176+
while (LMEM_PCCCR & LMEM_PCCCR_GO_MASK) {
176177
;
178+
}
177179
/* Enable code bus cache, enable write buffer */
178180
LMEM_PCCCR = (LMEM_PCCCR_ENWRBUF_MASK | LMEM_PCCCR_ENCACHE_MASK);
179181
barrier_isync_fence_full();

soc/nxp/imx/imx8/adsp/_soc_inthandlers.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,13 @@ static inline int _xtensa_handle_one_int2(unsigned int mask)
104104
int i = 0;
105105

106106
mask &= XCHAL_INTLEVEL2_MASK;
107-
for (i = 0; i <= 31; i++)
107+
for (i = 0; i <= 31; i++) {
108108
if (mask & BIT(i)) {
109109
mask = BIT(i);
110110
irq = i;
111111
goto handle_irq;
112112
}
113+
}
113114
return 0;
114115
handle_irq:
115116
_sw_isr_table[irq].isr(_sw_isr_table[irq].arg);

soc/nxp/imx/imx8m/adsp/_soc_inthandlers.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,13 @@ static inline int _xtensa_handle_one_int2(unsigned int mask)
104104
int i = 0;
105105

106106
mask &= XCHAL_INTLEVEL2_MASK;
107-
for (i = 0; i <= 31; i++)
107+
for (i = 0; i <= 31; i++) {
108108
if (mask & BIT(i)) {
109109
mask = BIT(i);
110110
irq = i;
111111
goto handle_irq;
112112
}
113+
}
113114
return 0;
114115
handle_irq:
115116
_sw_isr_table[irq].isr(_sw_isr_table[irq].arg);

soc/nxp/imx/imx8x/adsp/_soc_inthandlers.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,13 @@ static inline int _xtensa_handle_one_int2(unsigned int mask)
104104
int i = 0;
105105

106106
mask &= XCHAL_INTLEVEL2_MASK;
107-
for (i = 0; i <= 31; i++)
107+
for (i = 0; i <= 31; i++) {
108108
if (mask & BIT(i)) {
109109
mask = BIT(i);
110110
irq = i;
111111
goto handle_irq;
112112
}
113+
}
113114
return 0;
114115
handle_irq:
115116
_sw_isr_table[irq].isr(_sw_isr_table[irq].arg);

soc/sifive/sifive_freedom/fu500/clock.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ static int fu540_clock_init(void)
2828
PLL_RANGE(PLL_RANGE_33MHZ) |
2929
PLL_BYPASS(PLL_BYPASS_DISABLE) |
3030
PLL_FSE(PLL_FSE_INTERNAL);
31-
while ((PRCI_REG(PRCI_COREPLLCFG0) & PLL_LOCK(1)) == 0)
31+
while ((PRCI_REG(PRCI_COREPLLCFG0) & PLL_LOCK(1)) == 0) {
3232
;
33+
}
3334

3435
/* Switch clock to COREPLL */
3536
PRCI_REG(PRCI_CORECLKSEL) = CORECLKSEL_CORECLKSEL(CORECLKSEL_CORE_PLL);

soc/sifive/sifive_freedom/fu700/clock.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ static int fu740_clock_init(void)
4040
PLL_RANGE(PLL_RANGE_18MHZ) | /* 18MHz <= post divr(= 26MHz) < 30MHz */
4141
PLL_BYPASS(PLL_BYPASS_DISABLE) |
4242
PLL_FSE(PLL_FSE_INTERNAL);
43-
while ((PRCI_REG(PRCI_COREPLLCFG) & PLL_LOCK(1)) == 0)
43+
while ((PRCI_REG(PRCI_COREPLLCFG) & PLL_LOCK(1)) == 0) {
4444
;
45+
}
4546

4647
/* Switch CORE_CLK to CORE_PLL from HFCLK */
4748
PRCI_REG(PRCI_COREPLLSEL) = COREPLLSEL_SEL(COREPLLSEL_COREPLL);
@@ -54,8 +55,9 @@ static int fu740_clock_init(void)
5455
PLL_RANGE(PLL_RANGE_18MHZ) | /* 18MHz <= post divr(= 26MHz) < 30MHz */
5556
PLL_BYPASS(PLL_BYPASS_DISABLE) |
5657
PLL_FSE(PLL_FSE_INTERNAL);
57-
while ((PRCI_REG(PRCI_HFPCLKPLLCFG) & PLL_LOCK(1)) == 0)
58+
while ((PRCI_REG(PRCI_HFPCLKPLLCFG) & PLL_LOCK(1)) == 0) {
5859
;
60+
}
5961

6062
/* Switch PCLK to HFPCLKPLL/2 from HFCLK/2 */
6163
PRCI_REG(PRCI_HFPCLKPLLOUTDIV) = OUTDIV_PLLCKE(OUTDIV_PLLCKE_ENA);
@@ -68,8 +70,9 @@ static int fu740_clock_init(void)
6870
PLL_RANGE(PLL_RANGE_18MHZ) |
6971
PLL_BYPASS(PLL_BYPASS_DISABLE) |
7072
PLL_FSE(PLL_FSE_INTERNAL);
71-
while ((PRCI_REG(PRCI_DDRPLLCFG) & PLL_LOCK(1)) == 0)
73+
while ((PRCI_REG(PRCI_DDRPLLCFG) & PLL_LOCK(1)) == 0) {
7274
;
75+
}
7376

7477
PRCI_REG(PRCI_DDRPLLOUTDIV) |= OUTDIV_PLLCKE(OUTDIV_PLLCKE_ENA);
7578

soc/st/stm32/stm32h7x/soc_m4.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ static int stm32h7_m4_init(void)
5151
* End of system initialization is reached when CM7 takes HSEM.
5252
*/
5353
while ((HSEM->RLR[CFG_HW_ENTRY_STOP_MODE_SEMID] & HSEM_R_LOCK)
54-
!= HSEM_R_LOCK)
54+
!= HSEM_R_LOCK) {
5555
;
56+
}
5657
}
5758

5859
return 0;

0 commit comments

Comments
 (0)