Skip to content

Commit 8f197c9

Browse files
ndrs-psthenrikbrixandersen
authored andcommitted
style: subsys: 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 daae408 commit 8f197c9

File tree

10 files changed

+36
-20
lines changed

10 files changed

+36
-20
lines changed

subsys/debug/coredump/coredump_backend_intel_adsp_mem_window.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ static void coredump_mem_window_backend_buffer_output(uint8_t *buf, size_t bufle
5757
/* skip the overflow data. Don't wrap around to keep the most important data
5858
* such as registers and call stack in the beginning of mem window.
5959
*/
60-
if (mem_wptr >= ADSP_DW_SLOT_SIZE - 4)
60+
if (mem_wptr >= ADSP_DW_SLOT_SIZE - 4) {
6161
return;
62+
}
6263

6364
if (buf) {
6465
for (data_left = buflen; data_left > 0; data_left--) {

subsys/debug/thread_analyzer.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,31 +164,35 @@ static void isr_stacks(void)
164164
{
165165
unsigned int num_cpus = arch_num_cpus();
166166

167-
for (int i = 0; i < num_cpus; i++)
167+
for (int i = 0; i < num_cpus; i++) {
168168
isr_stack(i);
169+
}
169170
}
170171

171172
void thread_analyzer_run(thread_analyzer_cb cb, unsigned int cpu)
172173
{
173174
struct ta_cb_user_data ud = { .cb = cb, .cpu = cpu };
174175

175176
if (IS_ENABLED(CONFIG_THREAD_ANALYZER_RUN_UNLOCKED)) {
176-
if (IS_ENABLED(CONFIG_THREAD_ANALYZER_AUTO_SEPARATE_CORES))
177+
if (IS_ENABLED(CONFIG_THREAD_ANALYZER_AUTO_SEPARATE_CORES)) {
177178
k_thread_foreach_unlocked_filter_by_cpu(cpu, thread_analyze_cb, &ud);
178-
else
179+
} else {
179180
k_thread_foreach_unlocked(thread_analyze_cb, &ud);
181+
}
180182
} else {
181-
if (IS_ENABLED(CONFIG_THREAD_ANALYZER_AUTO_SEPARATE_CORES))
183+
if (IS_ENABLED(CONFIG_THREAD_ANALYZER_AUTO_SEPARATE_CORES)) {
182184
k_thread_foreach_filter_by_cpu(cpu, thread_analyze_cb, &ud);
183-
else
185+
} else {
184186
k_thread_foreach(thread_analyze_cb, &ud);
187+
}
185188
}
186189

187190
if (IS_ENABLED(CONFIG_THREAD_ANALYZER_ISR_STACK_USAGE)) {
188-
if (IS_ENABLED(CONFIG_THREAD_ANALYZER_AUTO_SEPARATE_CORES))
191+
if (IS_ENABLED(CONFIG_THREAD_ANALYZER_AUTO_SEPARATE_CORES)) {
189192
isr_stack(cpu);
190-
else
193+
} else {
191194
isr_stacks();
195+
}
192196
}
193197
}
194198

subsys/fs/fat_fs.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,11 @@ static int fatfs_rename(struct fs_mount_t *mountp, const char *from,
176176

177177
/* Check if 'to' path exists; remove it if it does */
178178
res = f_stat(translate_path(to), &fno);
179-
if (FR_OK == res) {
179+
if (res == FR_OK) {
180180
res = f_unlink(translate_path(to));
181-
if (FR_OK != res)
181+
if (res != FR_OK) {
182182
return translate_error(res);
183+
}
183184
}
184185

185186
res = f_rename(translate_path(from), translate_path(to));

subsys/ipc/ipc_service/lib/ipc_static_vrings.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,9 @@ int ipc_static_vrings_init(struct ipc_static_vrings *vr, unsigned int role)
166166
return -EINVAL;
167167
}
168168

169-
if (!vr->shm_device.name)
169+
if (!vr->shm_device.name) {
170170
vr->shm_device.name = SHM_DEVICE_DEFAULT_NAME;
171+
}
171172
vr->shm_device.num_regions = 1;
172173
vr->shm_physmap[0] = vr->shm_addr;
173174

subsys/llext/llext_link.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,9 @@ static void llext_link_plt(struct llext_loader *ldr, struct llext *ext,
144144
link_addr = llext_find_sym(NULL,
145145
SYM_NAME_OR_SLID(name, sym_tbl.st_value));
146146

147-
if (!link_addr)
147+
if (!link_addr) {
148148
link_addr = llext_find_sym(&ext->sym_tab, name);
149+
}
149150

150151
if (!link_addr) {
151152
LOG_WRN("PLT: cannot find idx %u name %s", j, name);

subsys/logging/backends/log_backend_adsp_mtrace.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,9 @@ static int char_out(uint8_t *data, size_t length, void *ctx)
133133
if (mtrace_active && mtrace_hook) {
134134

135135
/* if we are in panic mode, need to flush out asap */
136-
if (unlikely(mtrace_panic_mode))
136+
if (unlikely(mtrace_panic_mode)) {
137137
space_left = 0;
138+
}
138139

139140
mtrace_hook(out, space_left);
140141
}

subsys/mgmt/ec_host_cmd/backends/ec_host_cmd_backend_espi.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,9 @@ static int ec_host_cmd_espi_send(const struct ec_host_cmd_backend *backend)
131131
int ret;
132132

133133
/* Ignore in-progress on eSPI since interface is synchronous anyway */
134-
if (result == EC_HOST_CMD_IN_PROGRESS)
134+
if (result == EC_HOST_CMD_IN_PROGRESS) {
135135
return 0;
136+
}
136137

137138
hc_espi->state = ESPI_STATE_SENDING;
138139

subsys/net/ip/net_pkt.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1835,8 +1835,9 @@ static void clone_pkt_lladdr(struct net_pkt *pkt, struct net_pkt *clone_pkt,
18351835
{
18361836
int32_t ll_addr_offset;
18371837

1838-
if (!lladdr->addr)
1838+
if (!lladdr->addr) {
18391839
return;
1840+
}
18401841

18411842
ll_addr_offset = net_pkt_find_offset(pkt, lladdr->addr);
18421843

subsys/net/lib/zperf/zperf_udp_receiver.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,9 @@ static void zperf_udp_join_mcast_ipv4(char *if_name, struct in_addr *addr)
236236

237237
if (if_name[0]) {
238238
iface = net_if_get_by_index(net_if_get_by_name(if_name));
239-
if (iface == NULL)
239+
if (iface == NULL) {
240240
iface = net_if_get_default();
241+
}
241242
} else {
242243
iface = net_if_get_default();
243244
}
@@ -253,8 +254,9 @@ static void zperf_udp_join_mcast_ipv6(char *if_name, struct in6_addr *addr)
253254

254255
if (if_name[0]) {
255256
iface = net_if_get_by_index(net_if_get_by_name(if_name));
256-
if (iface == NULL)
257+
if (iface == NULL) {
257258
iface = net_if_get_default();
259+
}
258260
} else {
259261
iface = net_if_get_default();
260262
}
@@ -275,15 +277,17 @@ static void zperf_udp_leave_mcast(int sock)
275277
if (IS_ENABLED(CONFIG_NET_IPV4) && addr.sa_family == AF_INET) {
276278
struct sockaddr_in *addr4 = (struct sockaddr_in *)&addr;
277279

278-
if (net_ipv4_is_addr_mcast(&addr4->sin_addr))
280+
if (net_ipv4_is_addr_mcast(&addr4->sin_addr)) {
279281
net_ipv4_igmp_leave(iface, &addr4->sin_addr);
282+
}
280283
}
281284

282285
if (IS_ENABLED(CONFIG_NET_IPV6) && addr.sa_family == AF_INET6) {
283286
struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)&addr;
284287

285-
if (net_ipv6_is_addr_mcast(&addr6->sin6_addr))
288+
if (net_ipv6_is_addr_mcast(&addr6->sin6_addr)) {
286289
net_ipv6_mld_leave(iface, &addr6->sin6_addr);
290+
}
287291
}
288292
}
289293

subsys/tracing/tracing_backend_adsp_memory_window.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ static void tracing_backend_adsp_memory_window_output(
4141
if (length) {
4242
memcpy((void *)mem_window->data, data + to_copy, length);
4343
mem_window->head_offset = length;
44-
} else
44+
} else {
4545
mem_window->head_offset += to_copy;
46+
}
4647
}
4748

4849
static void tracing_backend_adsp_memory_window_init(void)

0 commit comments

Comments
 (0)