[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1612551572-495-2-git-send-email-alain.volmat@foss.st.com>
Date: Fri, 5 Feb 2021 19:59:25 +0100
From: Alain Volmat <alain.volmat@...s.st.com>
To: <broonie@...nel.org>, <amelie.delaunay@...s.st.com>
CC: <mcoquelin.stm32@...il.com>, <alexandre.torgue@...s.st.com>,
<linux-spi@...r.kernel.org>,
<linux-stm32@...md-mailman.stormreply.com>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, <fabrice.gasnier@...s.st.com>,
<alain.volmat@...s.st.com>
Subject: [PATCH v2 1/8] spi: stm32: properly handle 0 byte transfer
On 0 byte transfer request, return straight from the
xfer function after finalizing the transfer.
Fixes: dcbe0d84dfa5 ("spi: add driver for STM32 SPI controller")
Signed-off-by: Alain Volmat <alain.volmat@...s.st.com>
---
v2: remove useless spi_finalize_current_transfer
drivers/spi/spi-stm32.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index db3e305d9ec4..6cdecd1c5ec7 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -1657,6 +1657,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;
--
2.17.1
Powered by blists - more mailing lists