DMA Engine development
 help / color / mirror / Atom feed
* [PATCH -next] dmaengine: ptdma: Fix static checker warnings
@ 2025-03-12 12:10 Basavaraj Natikar
  2025-04-15  3:56 ` Basavaraj Natikar
  2025-04-17  7:18 ` Vinod Koul
  0 siblings, 2 replies; 3+ messages in thread
From: Basavaraj Natikar @ 2025-03-12 12:10 UTC (permalink / raw)
  To: vkoul, dmaengine; +Cc: Basavaraj Natikar, Dan Carpenter

An unnecessary extra check leads to the following static code checker
warning:

    drivers/dma/amd/ptdma/ptdma-dmaengine.c: pt_cmd_callback_work()
    warn: variable dereferenced before check 'desc'

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/all/bfa0a979-ce9f-422d-92c3-34921155d048@stanley.mountain/
Fixes: 656543989457 ("dmaengine: ptdma: Utilize the AE4DMA engine's multi-queue functionality")
Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
---
 drivers/dma/amd/ptdma/ptdma-dmaengine.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/dma/amd/ptdma/ptdma-dmaengine.c b/drivers/dma/amd/ptdma/ptdma-dmaengine.c
index 715ac3ae067b..d1d38ed811c2 100644
--- a/drivers/dma/amd/ptdma/ptdma-dmaengine.c
+++ b/drivers/dma/amd/ptdma/ptdma-dmaengine.c
@@ -355,16 +355,14 @@ static void pt_cmd_callback_work(void *data, int err)
 		desc->status = DMA_ERROR;
 
 	spin_lock_irqsave(&chan->vc.lock, flags);
-	if (desc) {
-		if (desc->status != DMA_COMPLETE) {
-			if (desc->status != DMA_ERROR)
-				desc->status = DMA_COMPLETE;
+	if (desc->status != DMA_COMPLETE) {
+		if (desc->status != DMA_ERROR)
+			desc->status = DMA_COMPLETE;
 
-			dma_cookie_complete(tx_desc);
-			dma_descriptor_unmap(tx_desc);
-		} else {
-			tx_desc = NULL;
-		}
+		dma_cookie_complete(tx_desc);
+		dma_descriptor_unmap(tx_desc);
+	} else {
+		tx_desc = NULL;
 	}
 	spin_unlock_irqrestore(&chan->vc.lock, flags);
 
-- 
2.34.1


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

end of thread, other threads:[~2025-04-17  7:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-12 12:10 [PATCH -next] dmaengine: ptdma: Fix static checker warnings Basavaraj Natikar
2025-04-15  3:56 ` Basavaraj Natikar
2025-04-17  7:18 ` Vinod Koul

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