Skip to contentSkip to conversation

fix and cleanup in spi-spacemit-k1

PATCH In review Pei Xiao 2 participants 4 messages Jul 20 – Jul 29

Subsystems (3)
lore
Share & tools
lore

Pei Xiao

author
#0 lore raw

cover 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

 drivers/spi/spi-spacemit-k1.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH 1/2 spi: spacemit: fix dangling TX DMA descriptor on RX prep failure

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")
---
 drivers/spi/spi-spacemit-k1.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/spi/spi-spacemit-k1.c +3 -1
index 215fe66d27b4..cd2955949c5c 100644
@@ -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;
Signature · 1 line
2.25.1
author
#2 lore raw

PATCH 2/2 spi: spacemit: drop redundant dev_err_probe() around irq helpers

In reply to 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.

---
 drivers/spi/spi-spacemit-k1.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi-spacemit-k1.c +2 -2
index cd2955949c5c..4348d77ec77c 100644
@@ -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);
Signature · 1 line
2.25.1
maintainer
#3 lore raw
In reply to Pei Xiao
Quoted 10 lines · Pei Xiao

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