Linux SPI subsystem development
 help / color / mirror / Atom feed
* [PATCH] spi: rzv2h-rspi: Fix DMA transfer error handling for signal interruption
@ 2026-06-26 16:02 Felix Gu
  2026-06-26 16:42 ` Wolfram Sang
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Felix Gu @ 2026-06-26 16:02 UTC (permalink / raw)
  To: Fabrizio Castro, Mark Brown, Cosmin Tanislav
  Cc: linux-spi, linux-renesas-soc, linux-kernel, Felix Gu

wait_event_interruptible_timeout() can return a negative error code when
interrupted by a signal. The original code treated all non-zero return
values as success, which would incorrectly synchronize DMA channels and
return 0 instead of propagating the interruption error.

Fixes: fa08b566860b ("spi: rzv2h-rspi: add support for DMA mode")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
 drivers/spi/spi-rzv2h-rspi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-rzv2h-rspi.c b/drivers/spi/spi-rzv2h-rspi.c
index 0738d448160d..daa4239b0fe0 100644
--- a/drivers/spi/spi-rzv2h-rspi.c
+++ b/drivers/spi/spi-rzv2h-rspi.c
@@ -366,14 +366,14 @@ static int rzv2h_rspi_transfer_dma(struct rzv2h_rspi_priv *rspi,
 	rzv2h_rspi_clear_all_irqs(rspi);
 
 	ret = wait_event_interruptible_timeout(rspi->wait, rspi->dma_callbacked, HZ);
-	if (ret) {
+	if (ret > 0) {
 		dmaengine_synchronize(rspi->controller->dma_tx);
 		dmaengine_synchronize(rspi->controller->dma_rx);
 		ret = 0;
 	} else {
 		dmaengine_terminate_sync(rspi->controller->dma_tx);
 		dmaengine_terminate_sync(rspi->controller->dma_rx);
-		ret = -ETIMEDOUT;
+		ret = ret ?: -ETIMEDOUT;
 	}
 
 	enable_irq(rspi->irq_rx);

---
base-commit: 30ffa8de54e5cc80d93fd211ca134d1764a7011f
change-id: 20260626-rspi-f0a56c6e5eca

Best regards,
--  
Felix Gu <ustc.gu@gmail.com>


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-07-01 11:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-26 16:02 [PATCH] spi: rzv2h-rspi: Fix DMA transfer error handling for signal interruption Felix Gu
2026-06-26 16:42 ` Wolfram Sang
2026-06-29 10:22   ` Cosmin-Gabriel Tanislav
2026-06-29 10:29     ` Fabrizio Castro
2026-06-29 10:32     ` wsa+renesas
2026-06-29 14:33       ` Cosmin-Gabriel Tanislav
2026-06-29 16:32         ` wsa+renesas
2026-06-29 16:33 ` Wolfram Sang
2026-06-30 18:58 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox