mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-02 15:18:19 +00:00
spi: stm32: properly handle 0 byte transfer
[ Upstream commit2269f5a8b1
] On 0 byte transfer request, return straight from the xfer function after finalizing the transfer. Fixes:dcbe0d84df
("spi: add driver for STM32 SPI controller") Signed-off-by: Alain Volmat <alain.volmat@foss.st.com> Link: https://lore.kernel.org/r/1612551572-495-2-git-send-email-alain.volmat@foss.st.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
5873b3a5fd
commit
7ca7532388
1 changed files with 4 additions and 0 deletions
|
@ -992,6 +992,10 @@ static int stm32_spi_transfer_one(struct spi_master *master,
|
|||
struct stm32_spi *spi = spi_master_get_devdata(master);
|
||||
int ret;
|
||||
|
||||
/* Don't do anything on 0 bytes transfers */
|
||||
if (transfer->len == 0)
|
||||
return 0;
|
||||
|
||||
spi->tx_buf = transfer->tx_buf;
|
||||
spi->rx_buf = transfer->rx_buf;
|
||||
spi->tx_len = spi->tx_buf ? transfer->len : 0;
|
||||
|
|
Loading…
Reference in a new issue