diff mbox series

check if dma is active before attempting to terminate

Message ID 20220603142340.42271-1-jensctl@gmail.com (mailing list archive)
State New, archived
Headers show
Series check if dma is active before attempting to terminate | expand

Commit Message

Jens Lindahl June 3, 2022, 2:23 p.m. UTC
---
 drivers/spi/spi-bcm2835.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Comments

Florian Fainelli June 6, 2022, 9:17 p.m. UTC | #1
On 6/3/2022 4:23 PM, Jens Lindahl wrote:
> ---
>   drivers/spi/spi-bcm2835.c | 12 ++++++++----
>   1 file changed, 8 insertions(+), 4 deletions(-)

Your patch looks reasonable but is not properly formed:

https://www.kernel.org/doc/html/latest/process/submitting-patches.html
Mark Brown June 6, 2022, 9:22 p.m. UTC | #2
On Mon, Jun 06, 2022 at 11:17:57PM +0200, Florian Fainelli wrote:
> 
> 
> On 6/3/2022 4:23 PM, Jens Lindahl wrote:
> > ---
> >   drivers/spi/spi-bcm2835.c | 12 ++++++++----
> >   1 file changed, 8 insertions(+), 4 deletions(-)
> 
> Your patch looks reasonable but is not properly formed:
> 
> https://www.kernel.org/doc/html/latest/process/submitting-patches.html

In particular:

You've not provided a Signed-off-by for this so I can't do anything with
it, please see Documentation/process/submitting-patches.rst for details
on what this is and why it's important.
diff mbox series

Patch

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 */