]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
spi: sh-msiof: Fix maximum DMA transfer size
authorGeert Uytterhoeven <geert+renesas@glider.be>
Fri, 16 May 2025 13:32:06 +0000 (15:32 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Jun 2025 10:07:07 +0000 (11:07 +0100)
commit11e8aff6bc0d594444068b99ea585b97d492c5c5
tree12f3cee504f588707148f2d89bd3c0fddab353ad
parenta175a490d00d3a9bf57055f3d84c82289d0536e8
spi: sh-msiof: Fix maximum DMA transfer size

[ Upstream commit 0941d5166629cb766000530945e54b4e49680c68 ]

The maximum amount of data to transfer in a single DMA request is
calculated from the FIFO sizes (which is technically not 100% correct,
but a simplification, as it is limited by the maximum word count values
in the Transmit and Control Data Registers).  However, in case there is
both data to transmit and to receive, the transmit limit is overwritten
by the receive limit.

Fix this by using the minimum applicable FIFO size instead.  Move the
calculation outside the loop, so it is not repeated for each individual
DMA transfer.

As currently tx_fifo_size is always equal to rx_fifo_size, this bug had
no real impact.

Fixes: fe78d0b7691c0274 ("spi: sh-msiof: Fix FIFO size to 64 word from 256 word")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/d9961767a97758b2614f2ee8afe1bd56dc900a60.1747401908.git.geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/spi/spi-sh-msiof.c