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

@ -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);
}
}
}