mirror of
https://github.com/espressif/esp-idf.git
synced 2025-12-07 17:08:49 +00:00
fix(i2s): reset the dma buf_size while allocation failed
Closes https://github.com/espressif/esp-idf/issues/15648
This commit is contained in:
@@ -113,9 +113,8 @@ static esp_err_t i2s_std_set_slot(i2s_chan_handle_t handle, const i2s_std_slot_c
|
||||
uint32_t buf_size = i2s_get_buf_size(handle, slot_cfg->data_bit_width, handle->dma.frame_num);
|
||||
/* The DMA buffer need to re-allocate if the buffer size changed */
|
||||
if (handle->dma.buf_size != buf_size) {
|
||||
handle->dma.buf_size = buf_size;
|
||||
ESP_RETURN_ON_ERROR(i2s_free_dma_desc(handle), TAG, "failed to free the old dma descriptor");
|
||||
ESP_RETURN_ON_ERROR(i2s_alloc_dma_desc(handle, handle->dma.desc_num, buf_size),
|
||||
ESP_RETURN_ON_ERROR(i2s_alloc_dma_desc(handle, buf_size),
|
||||
TAG, "allocate memory for dma descriptor failed");
|
||||
}
|
||||
bool is_slave = handle->role == I2S_ROLE_SLAVE;
|
||||
|
||||
Reference in New Issue
Block a user