style: tests: 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:35:07 +07:00 committed by Henrik Brix Andersen
commit b7d55d8ec6
8 changed files with 26 additions and 13 deletions

View file

@ -389,8 +389,9 @@ uint16_t event_counter(struct ll_conn *conn)
* return the current event counter value (i.e. -1);
* otherwise return the next event counter value
*/
if (*evt_active)
if (*evt_active) {
event_counter--;
}
return event_counter;
}

View file

@ -127,8 +127,9 @@ void service_b_3_1_remove(void)
*/
void service_b_3_1_value_v6_notify(void)
{
if (!value_v6_ntf_active)
if (!value_v6_ntf_active) {
return;
}
bt_gatt_notify(NULL, &service_b_3_1_attrs[1], &value_v6_value,
sizeof(value_v6_value));

View file

@ -131,8 +131,9 @@ void service_b_3_2_remove(void)
*/
void service_b_3_2_value_v6_notify(void)
{
if (!value_v6_ntf_active)
if (!value_v6_ntf_active) {
return;
}
bt_gatt_notify(NULL, &service_b_3_2_attrs[1], &value_v6_value,
sizeof(value_v6_value));
@ -160,8 +161,9 @@ static void value_v6_indicate_cb(struct bt_conn *conn,
*/
void service_b_3_2_value_v6_indicate(void)
{
if (!value_v6_ind_active)
if (!value_v6_ind_active) {
return;
}
/*
* NOTE: Zephyr doesn't automatically bump up the attribute pointer for
* indications as it does for notifications.

View file

@ -131,8 +131,9 @@ void service_b_3_3_remove(void)
*/
void service_b_3_3_value_v6_notify(void)
{
if (!value_v6_ntf_active)
if (!value_v6_ntf_active) {
return;
}
bt_gatt_notify(NULL, &service_b_3_3_attrs[1], &value_v6_value,
sizeof(value_v6_value));
@ -160,8 +161,9 @@ static void value_v6_indicate_cb(struct bt_conn *conn,
*/
void service_b_3_3_value_v6_indicate(void)
{
if (!value_v6_ind_active)
if (!value_v6_ind_active) {
return;
}
/*
* NOTE: Zephyr doesn't automatically bump up the attribute pointer for
* indications as it does for notifications.

View file

@ -63,8 +63,9 @@ static void before(void *args)
/* Flush the SQ and CQ */
rtio_sqe_drop_all(&sensor_read_rtio_ctx);
while (rtio_cqe_consume(&sensor_read_rtio_ctx))
while (rtio_cqe_consume(&sensor_read_rtio_ctx)) {
;
}
}
/**

View file

@ -32,12 +32,15 @@ static int lwm2m_get_res_buf_custom_fake(const struct lwm2m_obj_path *path, void
uint16_t *buffer_len, uint16_t *data_len,
uint8_t *data_flags)
{
if (buffer_ptr)
if (buffer_ptr) {
*buffer_ptr = my_buf;
if (buffer_len)
}
if (buffer_len) {
*buffer_len = sizeof(my_buf);
if (data_len)
}
if (data_len) {
*data_len = my_data_len;
}
return 0;
}

View file

@ -309,8 +309,9 @@ static void iface_cb(struct net_if *iface, void *user_data)
if ((iface != net_if_lookup_by_dev(DEVICE_GET(eth_test_dummy1))) &&
(iface != net_if_lookup_by_dev(DEVICE_GET(eth_test_dummy2))) &&
(iface != net_if_lookup_by_dev(DEVICE_GET(eth_test))) &&
(net_if_l2(iface) != &NET_L2_GET_NAME(VIRTUAL)))
(net_if_l2(iface) != &NET_L2_GET_NAME(VIRTUAL))) {
return;
}
DBG("Interface %p (%s) [%d]\n", iface, iface2str(iface),
net_if_get_by_iface(iface));

View file

@ -145,8 +145,9 @@ static int test_file_fsync(void)
{
int res = 0;
if (file < 0)
if (file < 0) {
return res;
}
res = fsync(file);
if (res < 0) {
@ -184,8 +185,9 @@ static int test_file_truncate(void)
int res = 0;
size_t truncate_size = sizeof(test_str) - 4;
if (file < 0)
if (file < 0) {
return res;
}
res = ftruncate(file, truncate_size);
if (res) {