Skip to content

Commit 0db43bc

Browse files
committed
modules: Fix initialization of state objects
After state objects were made local and not static anymore, they need to be zero-initialized. Signed-off-by: Jan Tore Guggedal <jantore.guggedal@nordicsemi.no>
1 parent c57f3d2 commit 0db43bc

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

app/src/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ int main(void)
669669
const uint32_t execution_time_ms =
670670
(CONFIG_APP_MSG_PROCESSING_TIMEOUT_SECONDS * MSEC_PER_SEC);
671671
const k_timeout_t zbus_wait_ms = K_MSEC(wdt_timeout_ms - execution_time_ms);
672-
struct main_state main_state;
672+
struct main_state main_state = { 0 };
673673

674674
main_state.interval_sec = CONFIG_APP_MODULE_TRIGGER_TIMEOUT_SECONDS;
675675

app/src/modules/cloud/cloud_module.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ static void cloud_module_thread(void)
704704
const uint32_t execution_time_ms =
705705
(CONFIG_APP_CLOUD_MSG_PROCESSING_TIMEOUT_SECONDS * MSEC_PER_SEC);
706706
const k_timeout_t zbus_wait_ms = K_MSEC(wdt_timeout_ms - execution_time_ms);
707-
struct cloud_state cloud_state;
707+
struct cloud_state cloud_state = { 0 };
708708

709709
LOG_DBG("cloud module task started");
710710

app/src/modules/environmental/environmental.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ static void environmental_task(void)
151151
const uint32_t execution_time_ms =
152152
(CONFIG_APP_ENVIRONMENTAL_MSG_PROCESSING_TIMEOUT_SECONDS * MSEC_PER_SEC);
153153
const k_timeout_t zbus_wait_ms = K_MSEC(wdt_timeout_ms - execution_time_ms);
154-
struct environmental_state environmental_state;
154+
struct environmental_state environmental_state = { 0 };
155155

156156
LOG_DBG("Environmental module task started");
157157

app/src/modules/led/led.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ static const struct pwm_dt_spec pwm_led2 = PWM_DT_SPEC_GET(PWM_LED2);
3838
/* Register log module */
3939
LOG_MODULE_REGISTER(led, CONFIG_APP_LED_LOG_LEVEL);
4040

41-
void led_callback(const struct zbus_channel *chan);
41+
static void led_callback(const struct zbus_channel *chan);
4242

4343
/* Register listener - led_callback will be called everytime a channel that the module listens on
4444
* receives a new message.
@@ -131,7 +131,7 @@ static void blink_timer_handler(struct k_work *work)
131131
}
132132

133133
/* Function called when there is a message received on a channel that the module listens to */
134-
void led_callback(const struct zbus_channel *chan)
134+
static void led_callback(const struct zbus_channel *chan)
135135
{
136136
if (&LED_CHAN == chan) {
137137
const struct led_msg *led_msg = zbus_chan_const_msg(chan);

app/src/modules/location/location.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ static void location_print_data_details(enum location_method method,
144144
#endif
145145
}
146146

147-
void location_task(void)
147+
static void location_task(void)
148148
{
149149
int err = 0;
150150
const struct zbus_channel *chan;

0 commit comments

Comments
 (0)