Re: [PATCH v3 6/6] spi: tegra210-quad: Add support for internal DMA

From: Jon Hunter
Date: Wed Apr 16 2025 - 10:23:39 EST



On 16/04/2025 12:57, Mukesh Kumar Savaliya wrote:

...

@@ -1384,41 +1419,43 @@ static irqreturn_t handle_dma_based_xfer(struct tegra_qspi *tqspi)
      unsigned int total_fifo_words;
      unsigned long flags;
      long wait_status;
-    int err = 0;
+    int num_errors = 0;
      if (tqspi->cur_direction & DATA_DIR_TX) {
          if (tqspi->tx_status) {
-            dmaengine_terminate_all(tqspi->tx_dma_chan);
-            err += 1;
-        } else {
+            if (tqspi->tx_dma_chan)
+                dmaengine_terminate_all(tqspi->tx_dma_chan);
+            num_errors++;
+        } else if (tqspi->tx_dma_chan) {
              wait_status = wait_for_completion_interruptible_timeout(
                  &tqspi->tx_dma_complete, QSPI_DMA_TIMEOUT);
              if (wait_status <= 0) {
                  dmaengine_terminate_all(tqspi->tx_dma_chan);
                  dev_err(tqspi->dev, "failed TX DMA transfer\n");
-                err += 1;
+                num_errors++;
what do you do with incrementing this local num_errors ?
I don't see any post processing .
Also all are are mutually exclusive due to if/else, not sequential. So could not get any specific usage.

This is really legacy code and yes I am not too thrilled with it either. At the same time this change is simply making the variable name a bit more clear. It is not critical that this is changed as part of this patch, but does not hurt either. I don't have strong feelings on this.

Jon

--
nvpublic