]> 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:05:10 +0000 (11:05 +0100)
commit259b74c2b3297ee464cd4a88199dd6aad4d9bb8d
tree4f68ec074e6773015e0a9a545b6a69ab8ba0aa53
parentcfc61c34077ef33e686b059ba9d6efa5694d42c3
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