Skip to content

Commit

Permalink
Nimble: Fix crash when attempting to do deinit
Browse files Browse the repository at this point in the history
If esp timer is created, but not started, and if we call Nimble deinit , then during deinit, the existing code checks for the
timer state and returns with a status other than ESP_OK. However, existing ESP_ERROR_CHECK macro treats this as failure and causes crash.

Modified the code to use ESP_ERROR_CHECK_WITHOUT_ABORT instead.
  • Loading branch information
rahult-github authored and ESPAbhinav committed Feb 14, 2024
1 parent 069b95a commit 1348149
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions porting/npl/freertos/src/npl_os_freertos.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,8 @@ void
npl_freertos_callout_deinit(struct ble_npl_callout *co)
{
#if CONFIG_BT_NIMBLE_USE_ESP_TIMER
ESP_ERROR_CHECK(esp_timer_stop(co->handle));
ESP_ERROR_CHECK(esp_timer_delete(co->handle));
ESP_ERROR_CHECK_WITHOUT_ABORT(esp_timer_stop(co->handle));
ESP_ERROR_CHECK_WITHOUT_ABORT(esp_timer_delete(co->handle));
#else
if (co->handle) {
xTimerDelete(co->handle, portMAX_DELAY);
Expand Down

0 comments on commit 1348149

Please sign in to comment.