[PATCH] i2c: at91: use dma safe buffers

Codrin.Ciubotariu at microchip.com Codrin.Ciubotariu at microchip.com
Tue Apr 5 02:23:46 PDT 2022


On 03.03.2022 18:17, Michael Walle wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> The supplied buffer might be on the stack and we get the following error
> message:
> [    3.312058] at91_i2c e0070600.i2c: rejecting DMA map of vmalloc memory
> 
> Use i2c_{get,put}_dma_safe_msg_buf() to get a DMA-able memory region if
> necessary.
> 
> Cc: stable at vger.kernel.org
> Signed-off-by: Michael Walle <michael at walle.cc>

Reviewed-by: Codrin Ciubotariu <codrin.ciubotariu at microchip.com>

> ---
> 
> I'm not sure if or which Fixes: tag I should add to this patch. The issue
> seems to be since a very long time, but nobody seem to have triggered it.
> FWIW, I'm using the sff,sfp driver, which triggers this.

I think it should be:
Fixes: 60937b2cdbf9 ("i2c: at91: add dma support")

> +       if (dev->use_dma) {
> +               dma_buf = i2c_get_dma_safe_msg_buf(m_start, 1);

If you want, you could just dev->buf = i2c_get_dma_safe...

> +               if (!dma_buf) {
> +                       ret = -ENOMEM;
> +                       goto out;
> +               }
> +               dev->buf = dma_buf;

Thanks!


More information about the linux-arm-kernel mailing list