Re: [PATCH 1/3] i2c: stm32: fix the device used for the DMA map
From: Alain Volmat <alain.volmat@foss.st.com>
Date: 2025-06-26 08:47:01
Also in:
dri-devel, linux-i2c, linux-media, lkml
From: Alain Volmat <alain.volmat@foss.st.com>
Date: 2025-06-26 08:47:01
Also in:
dri-devel, linux-i2c, linux-media, lkml
Hi Clément,
Oups, I was too fast.
there might be another place to correct in the driver, dma_unmap_single
within the error handling of the function stm32_i2c_prep_dma_xfer.
err:
dma_unmap_single(chan_dev, dma->dma_buf, dma->dma_len,
dma->dma_data_dir);
Could you also correct this one as well ?
Alain
On Thu, Jun 26, 2025 at 10:37:51AM +0200, Alain Volmat wrote:Hi Clément, On Mon, Jun 16, 2025 at 10:53:54AM +0200, Clément Le Goffic wrote:quoted
If the DMA mapping failed, it produced an error log with the wrong device name: "stm32-dma3 40400000.dma-controller: rejecting DMA map of vmalloc memory" Fix this issue by replacing the dev with the I2C dev.Indeed, nice catch ! Thanks a lot !quoted
Fixes: bb8822cbbc53 ("i2c: i2c-stm32: Add generic DMA API") Signed-off-by: Clément Le Goffic <redacted> --- drivers/i2c/busses/i2c-stm32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)diff --git a/drivers/i2c/busses/i2c-stm32.c b/drivers/i2c/busses/i2c-stm32.c index 157c64e27d0b..5e0b31aed774 100644 --- a/drivers/i2c/busses/i2c-stm32.c +++ b/drivers/i2c/busses/i2c-stm32.c@@ -118,7 +118,7 @@ int stm32_i2c_prep_dma_xfer(struct device *dev, struct stm32_i2c_dma *dma, dma->dma_len = len; chan_dev = dma->chan_using->device->dev; - dma->dma_buf = dma_map_single(chan_dev, buf, dma->dma_len, + dma->dma_buf = dma_map_single(dev, buf, dma->dma_len, dma->dma_data_dir); if (dma_mapping_error(chan_dev, dma->dma_buf)) { dev_err(dev, "DMA mapping failed\n");-- 2.43.0Acked-by: Alain Volmat <alain.volmat@foss.st.com> Regards, Alain