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 <pisit@ndrsolution.com>
This commit is contained in:
Pisit Sawangvonganan 2024-08-16 13:34:07 +07:00 committed by Henrik Brix Andersen
commit 8f197c955d
10 changed files with 36 additions and 20 deletions

View file

@ -57,8 +57,9 @@ static void coredump_mem_window_backend_buffer_output(uint8_t *buf, size_t bufle
/* skip the overflow data. Don't wrap around to keep the most important data
* such as registers and call stack in the beginning of mem window.
*/
if (mem_wptr >= ADSP_DW_SLOT_SIZE - 4)
if (mem_wptr >= ADSP_DW_SLOT_SIZE - 4) {
return;
}
if (buf) {
for (data_left = buflen; data_left > 0; data_left--) {

View file

@ -164,8 +164,9 @@ static void isr_stacks(void)
{
unsigned int num_cpus = arch_num_cpus();
for (int i = 0; i < num_cpus; i++)
for (int i = 0; i < num_cpus; i++) {
isr_stack(i);
}
}
void thread_analyzer_run(thread_analyzer_cb cb, unsigned int cpu)
@ -173,22 +174,25 @@ void thread_analyzer_run(thread_analyzer_cb cb, unsigned int cpu)
struct ta_cb_user_data ud = { .cb = cb, .cpu = cpu };
if (IS_ENABLED(CONFIG_THREAD_ANALYZER_RUN_UNLOCKED)) {
if (IS_ENABLED(CONFIG_THREAD_ANALYZER_AUTO_SEPARATE_CORES))
if (IS_ENABLED(CONFIG_THREAD_ANALYZER_AUTO_SEPARATE_CORES)) {
k_thread_foreach_unlocked_filter_by_cpu(cpu, thread_analyze_cb, &ud);
else
} else {
k_thread_foreach_unlocked(thread_analyze_cb, &ud);
}
} else {
if (IS_ENABLED(CONFIG_THREAD_ANALYZER_AUTO_SEPARATE_CORES))
if (IS_ENABLED(CONFIG_THREAD_ANALYZER_AUTO_SEPARATE_CORES)) {
k_thread_foreach_filter_by_cpu(cpu, thread_analyze_cb, &ud);
else
} else {
k_thread_foreach(thread_analyze_cb, &ud);
}
}
if (IS_ENABLED(CONFIG_THREAD_ANALYZER_ISR_STACK_USAGE)) {
if (IS_ENABLED(CONFIG_THREAD_ANALYZER_AUTO_SEPARATE_CORES))
if (IS_ENABLED(CONFIG_THREAD_ANALYZER_AUTO_SEPARATE_CORES)) {
isr_stack(cpu);
else
} else {
isr_stacks();
}
}
}

View file

@ -176,10 +176,11 @@ static int fatfs_rename(struct fs_mount_t *mountp, const char *from,
/* Check if 'to' path exists; remove it if it does */
res = f_stat(translate_path(to), &fno);
if (FR_OK == res) {
if (res == FR_OK) {
res = f_unlink(translate_path(to));
if (FR_OK != res)
if (res != FR_OK) {
return translate_error(res);
}
}
res = f_rename(translate_path(from), translate_path(to));

View file

@ -166,8 +166,9 @@ int ipc_static_vrings_init(struct ipc_static_vrings *vr, unsigned int role)
return -EINVAL;
}
if (!vr->shm_device.name)
if (!vr->shm_device.name) {
vr->shm_device.name = SHM_DEVICE_DEFAULT_NAME;
}
vr->shm_device.num_regions = 1;
vr->shm_physmap[0] = vr->shm_addr;

View file

@ -144,8 +144,9 @@ static void llext_link_plt(struct llext_loader *ldr, struct llext *ext,
link_addr = llext_find_sym(NULL,
SYM_NAME_OR_SLID(name, sym_tbl.st_value));
if (!link_addr)
if (!link_addr) {
link_addr = llext_find_sym(&ext->sym_tab, name);
}
if (!link_addr) {
LOG_WRN("PLT: cannot find idx %u name %s", j, name);

View file

@ -133,8 +133,9 @@ static int char_out(uint8_t *data, size_t length, void *ctx)
if (mtrace_active && mtrace_hook) {
/* if we are in panic mode, need to flush out asap */
if (unlikely(mtrace_panic_mode))
if (unlikely(mtrace_panic_mode)) {
space_left = 0;
}
mtrace_hook(out, space_left);
}

View file

@ -131,8 +131,9 @@ static int ec_host_cmd_espi_send(const struct ec_host_cmd_backend *backend)
int ret;
/* Ignore in-progress on eSPI since interface is synchronous anyway */
if (result == EC_HOST_CMD_IN_PROGRESS)
if (result == EC_HOST_CMD_IN_PROGRESS) {
return 0;
}
hc_espi->state = ESPI_STATE_SENDING;

View file

@ -1835,8 +1835,9 @@ static void clone_pkt_lladdr(struct net_pkt *pkt, struct net_pkt *clone_pkt,
{
int32_t ll_addr_offset;
if (!lladdr->addr)
if (!lladdr->addr) {
return;
}
ll_addr_offset = net_pkt_find_offset(pkt, lladdr->addr);

View file

@ -236,8 +236,9 @@ static void zperf_udp_join_mcast_ipv4(char *if_name, struct in_addr *addr)
if (if_name[0]) {
iface = net_if_get_by_index(net_if_get_by_name(if_name));
if (iface == NULL)
if (iface == NULL) {
iface = net_if_get_default();
}
} else {
iface = net_if_get_default();
}
@ -253,8 +254,9 @@ static void zperf_udp_join_mcast_ipv6(char *if_name, struct in6_addr *addr)
if (if_name[0]) {
iface = net_if_get_by_index(net_if_get_by_name(if_name));
if (iface == NULL)
if (iface == NULL) {
iface = net_if_get_default();
}
} else {
iface = net_if_get_default();
}
@ -275,15 +277,17 @@ static void zperf_udp_leave_mcast(int sock)
if (IS_ENABLED(CONFIG_NET_IPV4) && addr.sa_family == AF_INET) {
struct sockaddr_in *addr4 = (struct sockaddr_in *)&addr;
if (net_ipv4_is_addr_mcast(&addr4->sin_addr))
if (net_ipv4_is_addr_mcast(&addr4->sin_addr)) {
net_ipv4_igmp_leave(iface, &addr4->sin_addr);
}
}
if (IS_ENABLED(CONFIG_NET_IPV6) && addr.sa_family == AF_INET6) {
struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)&addr;
if (net_ipv6_is_addr_mcast(&addr6->sin6_addr))
if (net_ipv6_is_addr_mcast(&addr6->sin6_addr)) {
net_ipv6_mld_leave(iface, &addr6->sin6_addr);
}
}
}

View file

@ -41,8 +41,9 @@ static void tracing_backend_adsp_memory_window_output(
if (length) {
memcpy((void *)mem_window->data, data + to_copy, length);
mem_window->head_offset = length;
} else
} else {
mem_window->head_offset += to_copy;
}
}
static void tracing_backend_adsp_memory_window_init(void)