Skip to content

Commit f243679

Browse files
martinjaegernashif
authored andcommitted
task_wdt: ensure hw wdt is started before being fed
If a fallback hardware watchdog is used, it is fed together with the task watchdog in task_wdt_feed. However, the hardware watchdog was not yet set up before the first call to task_wdt_feed. This commit fixes the order of wdt_setup and task_wdt_feed calls. Fixes #39523 Signed-off-by: Martin Jäger <[email protected]>
1 parent 177f954 commit f243679

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

subsys/task_wdt/task_wdt.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ int task_wdt_add(uint32_t reload_period, task_wdt_callback_t callback,
164164
channels[id].user_data = user_data;
165165
channels[id].timeout_abs_ticks = K_TICKS_FOREVER;
166166
channels[id].callback = callback;
167-
task_wdt_feed(id);
168167

169168
#ifdef CONFIG_TASK_WDT_HW_FALLBACK
170169
if (!hw_wdt_started && hw_wdt_dev) {
@@ -174,6 +173,9 @@ int task_wdt_add(uint32_t reload_period, task_wdt_callback_t callback,
174173
hw_wdt_started = true;
175174
}
176175
#endif
176+
/* must be called after hw wdt has been started */
177+
task_wdt_feed(id);
178+
177179
return id;
178180
}
179181
}

0 commit comments

Comments
 (0)