DMA Engine development
 help / color / mirror / Atom feed
From: Vinod Koul <vkoul@kernel.org>
To: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
Cc: dmaengine@vger.kernel.org, Dan Carpenter <dan.carpenter@linaro.org>
Subject: Re: [PATCH -next] dmaengine: ptdma: Fix static checker warnings
Date: Thu, 17 Apr 2025 12:48:47 +0530	[thread overview]
Message-ID: <aACrV/Qwesp1lcJk@vaman> (raw)
In-Reply-To: <20250312121044.3638028-1-Basavaraj.Natikar@amd.com>

Hi,

On 12-03-25, 17:40, Basavaraj Natikar wrote:

Patch title should mention the changes and not cause, please revise
title

> 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'

Describe the fix please

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

-- 
~Vinod

      parent reply	other threads:[~2025-04-17  7:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aACrV/Qwesp1lcJk@vaman \
    --to=vkoul@kernel.org \
    --cc=Basavaraj.Natikar@amd.com \
    --cc=dan.carpenter@linaro.org \
    --cc=dmaengine@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox