Kasper Lund
Kasper Lund
Addressed by #2597.
Test skipped in 4e4e2eed4c727176f223cafa121f4fcb33423c4c.
Hmm. It actually looks like `buf_size` is set by `i2s_alloc_dma_desc`. I think we need to fix that too and just drop all the updates to `buf_size` outside of that function...
I suggest something like this to make `i2s_free_dma_desc` more robust. You don't really need to guard the call to `free` with a null check but that seems to be the...
Sorry @L-KAYA about the multiple updates, but I just realized that the handling of the `buf_size` field was wrong in more places - and the issue is always that it...
Hi @L-KAYA: I think this is a bit over the top. The `i2s_alloc_dma_desc` function will call `i2s_free_dma_desc` if allocations fail within it, so as long as free is robust and...
@L-KAYA - quick extra point: I think it is important the `buf_size` is always reset in `i2s_free_dma_desc` so make sure to do it before any returns in the function. Even...
For what it is worth, I dislike the early exit if `handle->dma.desc` is null, because it assumes that `dma.desc` is allocated before `dma.bufs` which is incredibly brittle.
Turns out I was wrong to set `handle->dma.desc_num` to zero when freeing. I also think it is wrong that it is being set in `i2s_alloc_dma_desc`. The `num` passed to `i2s_alloc_dma_desc`...
All calls to `i2s_alloc_dma_desc` just pass `handle->dma.desc_num` as `num` as far as I can tell: ``` $ git grep 'i2s_alloc_dma_desc' components/esp_driver_i2s/i2s_common.c:esp_err_t i2s_alloc_dma_desc(i2s_chan_handle_t handle, uint32_t num, uint32_t bufsize) components/esp_driver_i2s/i2s_pdm.c: ESP_RETURN_ON_ERROR(i2s_alloc_dma_desc(handle, handle->dma.desc_num,...