diff --git a/cores/esp32/esp32-hal-uart.c b/cores/esp32/esp32-hal-uart.c index 9e60d6be..b4442f75 100644 --- a/cores/esp32/esp32-hal-uart.c +++ b/cores/esp32/esp32-hal-uart.c @@ -481,7 +481,7 @@ int log_printf(const char *format, ...) vsnprintf(temp, len+1, format, arg); #if !CONFIG_DISABLE_HAL_LOCKS if(_uart_bus_array[s_uart_debug_nr].lock){ - while (xSemaphoreTake(_uart_bus_array[s_uart_debug_nr].lock, portMAX_DELAY) != pdPASS); + xSemaphoreTake(_uart_bus_array[s_uart_debug_nr].lock, portMAX_DELAY); ets_printf("%s", temp); xSemaphoreGive(_uart_bus_array[s_uart_debug_nr].lock); } else { @@ -491,7 +491,7 @@ int log_printf(const char *format, ...) ets_printf("%s", temp); #endif va_end(arg); - if(len > sizeof(loc_buf)){ + if(len >= sizeof(loc_buf)){ free(temp); } return len;