spi: Don't mark message DMA mapped when no transfer in it is
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Wed, 22 May 2024 17:09:49 +0000 (20:09 +0300)
committerMark Brown <broonie@kernel.org>
Thu, 23 May 2024 11:32:52 +0000 (12:32 +0100)
commit9f788ba457b45b0ce422943fcec9fa35c4587764
tree58225098d4abe403e93e6678a0755668b682fdca
parentd6e7ffd4820f8894eb865890c96852085d3640e1
spi: Don't mark message DMA mapped when no transfer in it is

There is no need to set the DMA mapped flag of the message if it has
no mapped transfers. Moreover, it may give the code a chance to take
the wrong paths, i.e. to exercise DMA related APIs on unmapped data.
Make __spi_map_msg() to bail earlier on the above mentioned cases.

Fixes: 99adef310f68 ("spi: Provide core support for DMA mapping transfers")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://msgid.link/r/20240522171018.3362521-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi.c