esp_system: fix incorrect critical section usage in usb_console

spinlock_acquire does not disable interrupts, whereas
portENTER_CRITICAL does.

Closes IDF-2049
This commit is contained in:
Ivan Grokhotkov 2020-10-12 17:07:15 +02:00
parent f10f27c01a
commit 4dc1195ca5

View File

@ -62,7 +62,7 @@ static esp_usb_console_cb_t s_tx_cb;
static void *s_cb_arg;
#ifdef CONFIG_ESP_CONSOLE_USB_CDC_SUPPORT_ETS_PRINTF
static spinlock_t s_write_lock = SPINLOCK_INITIALIZER;
static portMUX_TYPE s_write_lock = portMUX_INITIALIZER_UNLOCKED;
void esp_usb_console_write_char(char c);
#define ISR_FLAG ESP_INTR_FLAG_IRAM
#else
@ -407,11 +407,11 @@ void esp_usb_console_write_char(char c)
}
static inline void write_lock_acquire(void)
{
spinlock_acquire(&s_write_lock, SPINLOCK_WAIT_FOREVER);
portENTER_CRITICAL_SAFE(&s_write_lock);
}
static inline void write_lock_release(void)
{
spinlock_release(&s_write_lock);
portEXIT_CRITICAL_SAFE(&s_write_lock);
}
#else // CONFIG_ESP_CONSOLE_USB_CDC_SUPPORT_ETS_PRINTF