i2c: stm32f7: unmap DMA mapped buffer
commit 6aae87fe upstream. Before each I2C transfer using DMA, the I2C buffer is DMA'pped to make sure the memory buffer is DMA'able. This is handle in the function `stm32_i2c_prep_dma_xfer()`. If the transfer fails for any reason the I2C buffer must be unmap. Use the dma_callback to factorize the code and fix this issue. Note that the `stm32f7_i2c_dma_callback()` is now called in case of DMA transfer success and error and that the `complete()` on the dma_complete completion structure is done inconditionnally in case of transfer success or error as well as the `dmaengine_terminate_async()`. This is allowed as a `complete()` in case transfer error has no effect as well as a `dmaengine_terminate_async()` on a transfer success. Also fix the unneeded cast and remove not more needed variables. Fixes: 7ecc8cfd ("i2c: i2c-stm32f7: Add DMA support") Signed-off-by:Clément Le Goffic <clement.legoffic@foss.st.com> Cc: <stable@vger.kernel.org> # v4.18+ Acked-by:
Alain Volmat <alain.volmat@foss.st.com> Signed-off-by:
Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20250704-i2c-upstream-v4-2-84a095a2c728@foss.st.com Signed-off-by:
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Loading
Please sign in to comment