From 5a60192dae38f66fc9f751553443254fd9171e57 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Wed, 21 Jan 2026 11:33:04 +1100 Subject: [PATCH 1/2] fix(esp_system): Handle failures correctly in esp_task_wdt_reconfigure() - Failures were being masked as function always returned ESP_OK - In the failure path the spinlock was not unlocked, so interrupts became permanently disabled. Signed-off-by: Angus Gratton --- components/esp_system/task_wdt/task_wdt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/esp_system/task_wdt/task_wdt.c b/components/esp_system/task_wdt/task_wdt.c index bcb56b71777..04d0d020649 100644 --- a/components/esp_system/task_wdt/task_wdt.c +++ b/components/esp_system/task_wdt/task_wdt.c @@ -596,9 +596,9 @@ esp_err_t esp_task_wdt_reconfigure(const esp_task_wdt_config_t *config) esp_task_wdt_impl_timer_restart(p_twdt_obj->impl_ctx); } - portEXIT_CRITICAL(&spinlock); err: - return ESP_OK; + portEXIT_CRITICAL(&spinlock); + return ret; } esp_err_t esp_task_wdt_stop(void) From 2a1481e8e15dc69385f43b1f5e230c3e63332df6 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Wed, 21 Jan 2026 11:33:59 +1100 Subject: [PATCH 2/2] fix(esp_system): Allow esp_task_wdt_reconfigure() if timer is stopped If Task WDT is initialised but not start, the call to esp_timer_stop() in the reconfigure path returns ESP_ERR_INVALID_STATE and reconfiguring the Task WDT fails. This isn't the case when the Timer Group is used for Task WDT. (This failure cascades into the failure due to disabled interrupts, fixed in the parent commit.) Signed-off-by: Angus Gratton --- components/esp_system/task_wdt/task_wdt_impl_esp_timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esp_system/task_wdt/task_wdt_impl_esp_timer.c b/components/esp_system/task_wdt/task_wdt_impl_esp_timer.c index e88e077a45c..dc21eb93944 100644 --- a/components/esp_system/task_wdt/task_wdt_impl_esp_timer.c +++ b/components/esp_system/task_wdt/task_wdt_impl_esp_timer.c @@ -126,7 +126,7 @@ esp_err_t esp_task_wdt_impl_timer_stop(twdt_ctx_t obj) ret = ESP_ERR_INVALID_STATE; } - if (ret == ESP_OK) { + if (ret == ESP_OK && esp_timer_is_active(ctx->sw_timer)) { ret = esp_timer_stop(ctx->sw_timer); }