mirror of
https://github.com/espressif/esp-idf
synced 2025-03-12 02:29:10 -04:00
Merge branch 'bugfix/gpio_uninstall_isr_service_intr_wdt_crash_v4.2' into 'release/v4.2'
gpio: Bugfix - Move esp_intr_free() out of the critical section in gpio_uninstall_isr_service() (backport v4.2) See merge request espressif/esp-idf!16597
This commit is contained in:
commit
6683751579
@ -480,15 +480,21 @@ esp_err_t gpio_isr_handler_remove(gpio_num_t gpio_num)
|
|||||||
|
|
||||||
void gpio_uninstall_isr_service(void)
|
void gpio_uninstall_isr_service(void)
|
||||||
{
|
{
|
||||||
|
gpio_isr_func_t *gpio_isr_func_free = NULL;
|
||||||
|
gpio_isr_handle_t gpio_isr_handle_free = NULL;
|
||||||
|
portENTER_CRITICAL(&gpio_context.gpio_spinlock);
|
||||||
if (gpio_context.gpio_isr_func == NULL) {
|
if (gpio_context.gpio_isr_func == NULL) {
|
||||||
|
portEXIT_CRITICAL(&gpio_context.gpio_spinlock);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
portENTER_CRITICAL(&gpio_context.gpio_spinlock);
|
gpio_isr_func_free = gpio_context.gpio_isr_func;
|
||||||
esp_intr_free(gpio_context.gpio_isr_handle);
|
|
||||||
free(gpio_context.gpio_isr_func);
|
|
||||||
gpio_context.gpio_isr_func = NULL;
|
gpio_context.gpio_isr_func = NULL;
|
||||||
|
gpio_isr_handle_free = gpio_context.gpio_isr_handle;
|
||||||
|
gpio_context.gpio_isr_handle = NULL;
|
||||||
gpio_context.isr_core_id = GPIO_ISR_CORE_ID_UNINIT;
|
gpio_context.isr_core_id = GPIO_ISR_CORE_ID_UNINIT;
|
||||||
portEXIT_CRITICAL(&gpio_context.gpio_spinlock);
|
portEXIT_CRITICAL(&gpio_context.gpio_spinlock);
|
||||||
|
esp_intr_free(gpio_isr_handle_free);
|
||||||
|
free(gpio_isr_func_free);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -521,7 +527,12 @@ esp_err_t gpio_isr_register(void (*fn)(void *), void *arg, int intr_alloc_flags,
|
|||||||
#else /* CONFIG_FREERTOS_UNICORE */
|
#else /* CONFIG_FREERTOS_UNICORE */
|
||||||
ret = esp_ipc_call_blocking(gpio_context.isr_core_id, gpio_isr_register_on_core_static, (void *)&p);
|
ret = esp_ipc_call_blocking(gpio_context.isr_core_id, gpio_isr_register_on_core_static, (void *)&p);
|
||||||
#endif /* !CONFIG_FREERTOS_UNICORE */
|
#endif /* !CONFIG_FREERTOS_UNICORE */
|
||||||
if(ret != ESP_OK || p.ret != ESP_OK) {
|
if (ret != ESP_OK) {
|
||||||
|
ESP_LOGE(GPIO_TAG, "esp_ipc_call_blocking failed (0x%x)", ret);
|
||||||
|
return ESP_ERR_NOT_FOUND;
|
||||||
|
}
|
||||||
|
if (p.ret != ESP_OK) {
|
||||||
|
ESP_LOGE(GPIO_TAG, "esp_intr_alloc failed (0x%x)", p.ret);
|
||||||
return ESP_ERR_NOT_FOUND;
|
return ESP_ERR_NOT_FOUND;
|
||||||
}
|
}
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user