Skip to content

Commit

Permalink
Merge branch 'bugfix/freertos_hook_reg_invalid_arg_pr6275' into 'master'
Browse files Browse the repository at this point in the history
freertos_hooks: Fix unbalance lock in deregistration for cpu functions

Closes IDFGH-4472

See merge request espressif/esp-idf!11855
  • Loading branch information
projectgus committed Jan 7, 2021
2 parents cb9c4cb + 93c79c4 commit 16291ba
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions components/esp_common/src/freertos_hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ esp_err_t esp_register_freertos_tick_hook(esp_freertos_tick_cb_t new_tick_cb)

void esp_deregister_freertos_idle_hook_for_cpu(esp_freertos_idle_cb_t old_idle_cb, UBaseType_t cpuid)
{
portENTER_CRITICAL(&hooks_spinlock);
if(cpuid >= portNUM_PROCESSORS){
return;
}
portENTER_CRITICAL(&hooks_spinlock);
for(int n = 0; n < MAX_HOOKS; n++){
if(idle_cb[cpuid][n] == old_idle_cb) idle_cb[cpuid][n] = NULL;
}
Expand All @@ -130,10 +130,10 @@ void esp_deregister_freertos_idle_hook(esp_freertos_idle_cb_t old_idle_cb)

void esp_deregister_freertos_tick_hook_for_cpu(esp_freertos_tick_cb_t old_tick_cb, UBaseType_t cpuid)
{
portENTER_CRITICAL(&hooks_spinlock);
if(cpuid >= portNUM_PROCESSORS){
return;
}
portENTER_CRITICAL(&hooks_spinlock);
for(int n = 0; n < MAX_HOOKS; n++){
if(tick_cb[cpuid][n] == old_tick_cb) tick_cb[cpuid][n] = NULL;
}
Expand Down

0 comments on commit 16291ba

Please sign in to comment.