mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [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
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ 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


^ permalink raw reply	[flat|nested] 4+ 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
  2026-07-28 18:08 ` [PATCH 0/2] fix and cleanup in spi-spacemit-k1 Mark Brown
  2 siblings, 0 replies; 4+ 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


^ permalink raw reply	[flat|nested] 4+ 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
  2026-07-28 18:08 ` [PATCH 0/2] fix and cleanup in spi-spacemit-k1 Mark Brown
  2 siblings, 0 replies; 4+ 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


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

* Re: [PATCH 0/2] fix and cleanup in spi-spacemit-k1
  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
@ 2026-07-28 18:08 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2026-07-28 18:08 UTC (permalink / raw)
  To: dlan, elder, guodong, linux-spi, linux-riscv, spacemit,
	linux-kernel, Pei Xiao

On Mon, 20 Jul 2026 14:08:42 +0800, Pei Xiao wrote:
> fix and cleanup in spi-spacemit-k1
> 
> 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
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-7.3

Thanks!

[1/2] spi: spacemit: fix dangling TX DMA descriptor on RX prep failure
      https://git.kernel.org/broonie/spi/c/8955fbad8aad
[2/2] spi: spacemit: drop redundant dev_err_probe() around irq helpers
      https://git.kernel.org/broonie/spi/c/79052a6a6f5b

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


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

end of thread, other threads:[~2026-07-29 13:32 UTC | newest]

Thread overview: 4+ 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
2026-07-28 18:08 ` [PATCH 0/2] fix and cleanup in spi-spacemit-k1 Mark Brown

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

all inboxes | Powered by JetHome®