task_wdt: fix silent init failures

The task_wdt_init() API can fail to install a timeout for the fallback
hardware WDT (hw_wdt) without returning an error code.  This patch
enables task_wdt_init() to return the hw_wdt install timeout error code
if the hw_wdt install timeout fails.

Signed-off-by: Nick Ward <nick.ward@setec.com.au>
This commit is contained in:
Nick Ward 2021-09-10 22:50:47 +10:00 committed by Carles Cufí
commit e0f18128bf
3 changed files with 14 additions and 1 deletions

View file

@ -136,6 +136,10 @@ int task_wdt_init(const struct device *hw_wdt)
hw_wdt_dev = hw_wdt;
hw_wdt_channel = wdt_install_timeout(hw_wdt_dev, &wdt_config);
if (hw_wdt_channel < 0) {
LOG_ERR("hw_wdt install timeout failed: %d", hw_wdt_channel);
return hw_wdt_channel;
}
#else
return -ENOTSUP;
#endif