Skip to content

Commit 852f7c2

Browse files
committed
modules: fix issues pointed out by static analysis
fix issues pointed out by static analysis Signed-off-by: Simen S. Røstad <simen.rostad@nordicsemi.no>
1 parent 80e607f commit 852f7c2

File tree

2 files changed

+13
-17
lines changed

2 files changed

+13
-17
lines changed

app/src/modules/app/app.c

+11-15
Original file line numberDiff line numberDiff line change
@@ -269,11 +269,10 @@ static void running_run(void *o)
269269
{
270270
const struct app_state_object *state_object = (const struct app_state_object *)o;
271271

272-
if (state_object->chan == &FOTA_CHAN) {
273-
if (state_object->fota_status == FOTA_DOWNLOADING_UPDATE) {
274-
STATE_SET(app_state, STATE_FOTA);
275-
return;
276-
}
272+
if (state_object->chan == &FOTA_CHAN &&
273+
state_object->fota_status == FOTA_DOWNLOADING_UPDATE) {
274+
STATE_SET(app_state, STATE_FOTA);
275+
return;
277276
}
278277
}
279278

@@ -435,11 +434,10 @@ static void fota_network_disconnect_pending_run(void *o)
435434
{
436435
const struct app_state_object *state_object = (const struct app_state_object *)o;
437436

438-
if (state_object->chan == &NETWORK_CHAN) {
439-
if (state_object->network_status == NETWORK_DISCONNECTED) {
440-
STATE_SET(app_state, STATE_FOTA_IMAGE_APPLY_PENDING);
441-
return;
442-
}
437+
if (state_object->chan == &NETWORK_CHAN &&
438+
state_object->network_status == NETWORK_DISCONNECTED) {
439+
STATE_SET(app_state, STATE_FOTA_IMAGE_APPLY_PENDING);
440+
return;
443441
}
444442
}
445443

@@ -465,11 +463,9 @@ static void fota_image_apply_pending_run(void *o)
465463
{
466464
const struct app_state_object *state_object = (const struct app_state_object *)o;
467465

468-
if (state_object->chan == &FOTA_CHAN) {
469-
if (state_object->fota_status == FOTA_REBOOT_NEEDED) {
470-
STATE_SET(app_state, STATE_FOTA_REBOOTING);
471-
return;
472-
}
466+
if (state_object->chan == &FOTA_CHAN && state_object->fota_status == FOTA_REBOOT_NEEDED) {
467+
STATE_SET(app_state, STATE_FOTA_REBOOTING);
468+
return;
473469
}
474470
}
475471

tests/module/fota/src/fota_module_test.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ void tearDown(void)
7171
event_expect(FOTA_CANCEL);
7272
}
7373

74-
void event_expect(enum fota_msg_type expected_fota_type)
74+
static void event_expect(enum fota_msg_type expected_fota_type)
7575
{
7676
int err;
7777
const struct zbus_channel *chan;
@@ -96,7 +96,7 @@ void event_expect(enum fota_msg_type expected_fota_type)
9696
TEST_ASSERT_EQUAL(expected_fota_type, fota_msg);
9797
}
9898

99-
void no_events_expect(uint32_t time_in_seconds)
99+
static void no_events_expect(uint32_t time_in_seconds)
100100
{
101101
int err;
102102
const struct zbus_channel *chan;

0 commit comments

Comments
 (0)