Skip to content

Commit b7d55d8

Browse files
ndrs-psthenrikbrixandersen
authored andcommitted
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 <[email protected]>
1 parent 8f197c9 commit b7d55d8

File tree

8 files changed

+26
-13
lines changed

8 files changed

+26
-13
lines changed

tests/bluetooth/controller/common/src/helper_util.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,8 +389,9 @@ uint16_t event_counter(struct ll_conn *conn)
389389
* return the current event counter value (i.e. -1);
390390
* otherwise return the next event counter value
391391
*/
392-
if (*evt_active)
392+
if (*evt_active) {
393393
event_counter--;
394+
}
394395

395396
return event_counter;
396397
}

tests/bsim/bluetooth/ll/edtt/gatt_test_app/src/gatt/service_b_3_1.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,9 @@ void service_b_3_1_remove(void)
127127
*/
128128
void service_b_3_1_value_v6_notify(void)
129129
{
130-
if (!value_v6_ntf_active)
130+
if (!value_v6_ntf_active) {
131131
return;
132+
}
132133

133134
bt_gatt_notify(NULL, &service_b_3_1_attrs[1], &value_v6_value,
134135
sizeof(value_v6_value));

tests/bsim/bluetooth/ll/edtt/gatt_test_app/src/gatt/service_b_3_2.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,9 @@ void service_b_3_2_remove(void)
131131
*/
132132
void service_b_3_2_value_v6_notify(void)
133133
{
134-
if (!value_v6_ntf_active)
134+
if (!value_v6_ntf_active) {
135135
return;
136+
}
136137

137138
bt_gatt_notify(NULL, &service_b_3_2_attrs[1], &value_v6_value,
138139
sizeof(value_v6_value));
@@ -160,8 +161,9 @@ static void value_v6_indicate_cb(struct bt_conn *conn,
160161
*/
161162
void service_b_3_2_value_v6_indicate(void)
162163
{
163-
if (!value_v6_ind_active)
164+
if (!value_v6_ind_active) {
164165
return;
166+
}
165167
/*
166168
* NOTE: Zephyr doesn't automatically bump up the attribute pointer for
167169
* indications as it does for notifications.

tests/bsim/bluetooth/ll/edtt/gatt_test_app/src/gatt/service_b_3_3.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,9 @@ void service_b_3_3_remove(void)
131131
*/
132132
void service_b_3_3_value_v6_notify(void)
133133
{
134-
if (!value_v6_ntf_active)
134+
if (!value_v6_ntf_active) {
135135
return;
136+
}
136137

137138
bt_gatt_notify(NULL, &service_b_3_3_attrs[1], &value_v6_value,
138139
sizeof(value_v6_value));
@@ -160,8 +161,9 @@ static void value_v6_indicate_cb(struct bt_conn *conn,
160161
*/
161162
void service_b_3_3_value_v6_indicate(void)
162163
{
163-
if (!value_v6_ind_active)
164+
if (!value_v6_ind_active) {
164165
return;
166+
}
165167
/*
166168
* NOTE: Zephyr doesn't automatically bump up the attribute pointer for
167169
* indications as it does for notifications.

tests/drivers/build_all/sensor/src/generic_test.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ static void before(void *args)
6363

6464
/* Flush the SQ and CQ */
6565
rtio_sqe_drop_all(&sensor_read_rtio_ctx);
66-
while (rtio_cqe_consume(&sensor_read_rtio_ctx))
66+
while (rtio_cqe_consume(&sensor_read_rtio_ctx)) {
6767
;
68+
}
6869
}
6970

7071
/**

tests/net/lib/lwm2m/lwm2m_engine/src/main.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,15 @@ static int lwm2m_get_res_buf_custom_fake(const struct lwm2m_obj_path *path, void
3232
uint16_t *buffer_len, uint16_t *data_len,
3333
uint8_t *data_flags)
3434
{
35-
if (buffer_ptr)
35+
if (buffer_ptr) {
3636
*buffer_ptr = my_buf;
37-
if (buffer_len)
37+
}
38+
if (buffer_len) {
3839
*buffer_len = sizeof(my_buf);
39-
if (data_len)
40+
}
41+
if (data_len) {
4042
*data_len = my_data_len;
43+
}
4144

4245
return 0;
4346
}

tests/net/virtual/src/main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,9 @@ static void iface_cb(struct net_if *iface, void *user_data)
309309
if ((iface != net_if_lookup_by_dev(DEVICE_GET(eth_test_dummy1))) &&
310310
(iface != net_if_lookup_by_dev(DEVICE_GET(eth_test_dummy2))) &&
311311
(iface != net_if_lookup_by_dev(DEVICE_GET(eth_test))) &&
312-
(net_if_l2(iface) != &NET_L2_GET_NAME(VIRTUAL)))
312+
(net_if_l2(iface) != &NET_L2_GET_NAME(VIRTUAL))) {
313313
return;
314+
}
314315

315316
DBG("Interface %p (%s) [%d]\n", iface, iface2str(iface),
316317
net_if_get_by_iface(iface));

tests/posix/fs/src/test_fs_file.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,9 @@ static int test_file_fsync(void)
145145
{
146146
int res = 0;
147147

148-
if (file < 0)
148+
if (file < 0) {
149149
return res;
150+
}
150151

151152
res = fsync(file);
152153
if (res < 0) {
@@ -184,8 +185,9 @@ static int test_file_truncate(void)
184185
int res = 0;
185186
size_t truncate_size = sizeof(test_str) - 4;
186187

187-
if (file < 0)
188+
if (file < 0) {
188189
return res;
190+
}
189191

190192
res = ftruncate(file, truncate_size);
191193
if (res) {

0 commit comments

Comments
 (0)