dmaengine: ptdma: Move variable condition check to the first place and remove redundancy
authorBasavaraj Natikar <Basavaraj.Natikar@amd.com>
Mon, 21 Apr 2025 11:42:15 +0000 (17:12 +0530)
committerVinod Koul <vkoul@kernel.org>
Wed, 23 Apr 2025 12:11:32 +0000 (17:41 +0530)
commit305245a2e1d633e5f821178c98c6d6132cea2bdb
tree0ddc3139a51c8cb4fab3215222b9e2ec82b1cbf5
parent8dfa57aabff625bf445548257f7711ef294cd30e
dmaengine: ptdma: Move variable condition check to the first place and remove redundancy

The variable is dereferenced without first checking if it's null, leading
to the following warning: 'Variable dereferenced before check: desc.'

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

Therefore, move the condition check for the 'desc' variable to the first
place and remove the redundant extra condition check.

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>
Link: https://lore.kernel.org/r/20250421114215.1687073-1-Basavaraj.Natikar@amd.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/amd/ptdma/ptdma-dmaengine.c