* [PATCH 0/2] fix and cleanup in spi-spacemit-k1
@ 2026-07-20 6:08 Pei Xiao
2026-07-20 6:08 ` [PATCH 1/2] spi: spacemit: fix dangling TX DMA descriptor on RX prep failure Pei Xiao
2026-07-20 6:08 ` [PATCH 2/2] spi: spacemit: drop redundant dev_err_probe() around irq helpers Pei Xiao
0 siblings, 2 replies; 3+ messages in thread
From: Pei Xiao @ 2026-07-20 6:08 UTC (permalink / raw)
To: broonie, dlan, elder, guodong, linux-spi, linux-riscv, spacemit,
linux-kernel
Cc: Pei Xiao
1.fix TX DMA descriptor on RX prep failure
2. drop redundant dev_err_probe() around irq
Pei Xiao (2):
spi: spacemit: fix dangling TX DMA descriptor on RX prep failure
spi: spacemit: drop redundant dev_err_probe() around irq helpers
drivers/spi/spi-spacemit-k1.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
--
2.25.1
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] spi: spacemit: fix dangling TX DMA descriptor on RX prep failure
2026-07-20 6:08 [PATCH 0/2] fix and cleanup in spi-spacemit-k1 Pei Xiao
@ 2026-07-20 6:08 ` Pei Xiao
2026-07-20 6:08 ` [PATCH 2/2] spi: spacemit: drop redundant dev_err_probe() around irq helpers Pei Xiao
1 sibling, 0 replies; 3+ messages in thread
From: Pei Xiao @ 2026-07-20 6:08 UTC (permalink / raw)
To: broonie, dlan, elder, guodong, linux-spi, linux-riscv, spacemit,
linux-kernel
Cc: Pei Xiao
In k1_spi_dma_one(), the TX DMA descriptor is submitted via
dmaengine_submit() before the RX descriptor is prepared. If
k1_spi_dma_prep() fails for RX, the function jumps to the fallback
path without terminating the already-submitted TX descriptor.
So terminate the TX channel with dmaengine_terminate_sync() when RX
descriptor preparation fails.
Fixes: efcd8b9d1111 ("spi: spacemit: introduce SpacemiT K1 SPI controller driver")
Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
---
drivers/spi/spi-spacemit-k1.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/spi/spi-spacemit-k1.c b/drivers/spi/spi-spacemit-k1.c
index 215fe66d27b4..cd2955949c5c 100644
--- a/drivers/spi/spi-spacemit-k1.c
+++ b/drivers/spi/spi-spacemit-k1.c
@@ -289,8 +289,10 @@ static int k1_spi_dma_one(struct spi_controller *host, struct spi_device *spi,
/* Prepare the RX descriptor and submit it */
desc = k1_spi_dma_prep(drv_data, transfer, false);
- if (!desc)
+ if (!desc) {
+ dmaengine_terminate_sync(host->dma_tx);
goto fallback;
+ }
/* When RX is complete we also know TX has completed */
desc->callback = k1_spi_dma_callback;
--
2.25.1
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] spi: spacemit: drop redundant dev_err_probe() around irq helpers
2026-07-20 6:08 [PATCH 0/2] fix and cleanup in spi-spacemit-k1 Pei Xiao
2026-07-20 6:08 ` [PATCH 1/2] spi: spacemit: fix dangling TX DMA descriptor on RX prep failure Pei Xiao
@ 2026-07-20 6:08 ` Pei Xiao
1 sibling, 0 replies; 3+ messages in thread
From: Pei Xiao @ 2026-07-20 6:08 UTC (permalink / raw)
To: broonie, dlan, elder, guodong, linux-spi, linux-riscv, spacemit,
linux-kernel
Cc: Pei Xiao
platform_get_irq() and devm_request_irq() already print an error
message via dev_err_probe() on failure, so wrapping them with
another dev_err_probe() results in duplicate error output.
Return the error code directly instead.
Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
---
drivers/spi/spi-spacemit-k1.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi-spacemit-k1.c b/drivers/spi/spi-spacemit-k1.c
index cd2955949c5c..4348d77ec77c 100644
--- a/drivers/spi/spi-spacemit-k1.c
+++ b/drivers/spi/spi-spacemit-k1.c
@@ -737,12 +737,12 @@ static int k1_spi_probe(struct platform_device *pdev)
drv_data->irq = platform_get_irq(pdev, 0);
if (drv_data->irq < 0)
- return dev_err_probe(dev, drv_data->irq, "error getting IRQ\n");
+ return drv_data->irq;
ret = devm_request_irq(dev, drv_data->irq, k1_spi_ssp_isr,
IRQF_SHARED, dev_name(dev), drv_data);
if (ret < 0)
- return dev_err_probe(dev, ret, "error requesting IRQ\n");
+ return ret;
/* Initialize the host structure, then register it */
host->dev.of_node = dev_of_node(dev);
--
2.25.1
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-07-20 6:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-20 6:08 [PATCH 0/2] fix and cleanup in spi-spacemit-k1 Pei Xiao
2026-07-20 6:08 ` [PATCH 1/2] spi: spacemit: fix dangling TX DMA descriptor on RX prep failure Pei Xiao
2026-07-20 6:08 ` [PATCH 2/2] spi: spacemit: drop redundant dev_err_probe() around irq helpers Pei Xiao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox