Merge branch 'bugfix/uart_sclk_freq' into 'master'

uart: fixed sclk_freq not init warning when compiling with asserts disabled

Closes IDFGH-8144

See merge request espressif/esp-idf!19792
This commit is contained in:
Marius Vikhammer 2022-08-30 16:24:38 +08:00
commit dfaaefe2ce
2 changed files with 5 additions and 6 deletions

View File

@ -303,8 +303,7 @@ esp_err_t uart_set_baudrate(uart_port_t uart_num, uint32_t baud_rate)
uint32_t sclk_freq;
uart_hal_get_sclk(&(uart_context[uart_num].hal), &src_clk);
esp_err_t err = uart_get_sclk_freq(src_clk, &sclk_freq);
assert(err == ESP_OK);
ESP_RETURN_ON_ERROR(uart_get_sclk_freq(src_clk, &sclk_freq), UART_TAG, "Invalid src_clk");
UART_ENTER_CRITICAL(&(uart_context[uart_num].spinlock));
uart_hal_set_baudrate(&(uart_context[uart_num].hal), baud_rate, sclk_freq);
@ -320,8 +319,7 @@ esp_err_t uart_get_baudrate(uart_port_t uart_num, uint32_t *baudrate)
uint32_t sclk_freq;
uart_hal_get_sclk(&(uart_context[uart_num].hal), &src_clk);
esp_err_t err = uart_get_sclk_freq(src_clk, &sclk_freq);
assert(err == ESP_OK);
ESP_RETURN_ON_ERROR(uart_get_sclk_freq(src_clk, &sclk_freq), UART_TAG, "Invalid src_clk");
UART_ENTER_CRITICAL(&(uart_context[uart_num].spinlock));
uart_hal_get_baudrate(&(uart_context[uart_num].hal), baudrate, sclk_freq);
@ -747,8 +745,7 @@ esp_err_t uart_param_config(uart_port_t uart_num, const uart_config_t *uart_conf
}
#endif
uint32_t sclk_freq;
esp_err_t err = uart_get_sclk_freq(uart_config->source_clk, &sclk_freq);
assert(err == ESP_OK);
ESP_RETURN_ON_ERROR(uart_get_sclk_freq(uart_config->source_clk, &sclk_freq), UART_TAG, "Invalid src_clk");
UART_ENTER_CRITICAL(&(uart_context[uart_num].spinlock));
uart_hal_init(&(uart_context[uart_num].hal), uart_num);

View File

@ -0,0 +1,2 @@
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE=y
CONFIG_COMPILER_OPTIMIZATION_PERF=y