DMA Engine development
 help / color / mirror / Atom feed
From: Basavaraj Natikar <bnatikar@amd.com>
To: vkoul@kernel.org, dmaengine@vger.kernel.org
Subject: Re: [PATCH -next] dmaengine: ptdma: Fix static checker warnings
Date: Tue, 15 Apr 2025 09:26:23 +0530	[thread overview]
Message-ID: <bb316bcf-6842-4f11-a4db-d3cb23f31593@amd.com> (raw)
In-Reply-To: <20250312121044.3638028-1-Basavaraj.Natikar@amd.com>

Hi Vinod,

Just a gentle reminder regarding my previous message.
Looking forward to your response.

Thanks,
—
Basavaraj

On 3/12/2025 5:40 PM, Basavaraj Natikar wrote:
> 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);
>   


  reply	other threads:[~2025-04-15  3:56 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 [this message]
2025-04-17  7:18 ` Vinod Koul

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=bb316bcf-6842-4f11-a4db-d3cb23f31593@amd.com \
    --to=bnatikar@amd.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=vkoul@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