i2c: imx: Only DMA messages with I2C_M_DMA_SAFE flag set
authorAndrew Lunn <andrew@lunn.ch>
Wed, 9 Nov 2022 23:59:02 +0000 (00:59 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Dec 2022 10:28:45 +0000 (11:28 +0100)
commit2d16161a2c98730dc56d456e6dd1702a0a9fe735
tree7fdce16ca8bad9f0224e72c7ca0f59c1ab5aa99a
parent950a05cb15e3cf1769b9e093f0f0dbb7e261e5d7
i2c: imx: Only DMA messages with I2C_M_DMA_SAFE flag set

[ Upstream commit d36678f7905cbd1dc55a8a96e066dafd749d4600 ]

Recent changes to the DMA code has resulting in the IMX driver failing
I2C transfers when the buffer has been vmalloc. Only perform DMA
transfers if the message has the I2C_M_DMA_SAFE flag set, indicating
the client is providing a buffer which is DMA safe.

This is a minimal fix for stable. The I2C core provides helpers to
allocate a bounce buffer. For a fuller fix the master should make use
of these helpers.

Fixes: 4544b9f25e70 ("dma-mapping: Add vmap checks to dma_map_single()")
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/i2c/busses/i2c-imx.c