linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] check if dma is active before attempting to terminate
@ 2022-06-03 14:23 Jens Lindahl
  2022-06-06 21:17 ` Florian Fainelli
  0 siblings, 1 reply; 3+ messages in thread
From: Jens Lindahl @ 2022-06-03 14:23 UTC (permalink / raw)
  To: linux-spi
  Cc: Jens Lindahl, Mark Brown, Florian Fainelli, Ray Jui,
	Scott Branden, Broadcom internal kernel review list,
	Nicolas Saenz Julienne

---
 drivers/spi/spi-bcm2835.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c
index 775c0bf2f..84e72b8dd 100644
--- a/drivers/spi/spi-bcm2835.c
+++ b/drivers/spi/spi-bcm2835.c
@@ -1138,10 +1138,14 @@ static void bcm2835_spi_handle_err(struct spi_controller *ctlr,
 	struct bcm2835_spi *bs = spi_controller_get_devdata(ctlr);
 
 	/* if an error occurred and we have an active dma, then terminate */
-	dmaengine_terminate_sync(ctlr->dma_tx);
-	bs->tx_dma_active = false;
-	dmaengine_terminate_sync(ctlr->dma_rx);
-	bs->rx_dma_active = false;
+	if (bs->tx_dma_active) {
+		dmaengine_terminate_sync(ctlr->dma_tx);
+		bs->tx_dma_active = false;
+	}
+	if (bs->rx_dma_active) {
+		dmaengine_terminate_sync(ctlr->dma_rx);
+		bs->rx_dma_active = false;
+	}
 	bcm2835_spi_undo_prologue(bs);
 
 	/* and reset */
-- 
2.20.1 (Apple Git-117)


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

end of thread, other threads:[~2022-06-06 21:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-03 14:23 [PATCH] check if dma is active before attempting to terminate Jens Lindahl
2022-06-06 21:17 ` Florian Fainelli
2022-06-06 21:22   ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).