DMA Engine development
 help / color / mirror / Atom feed
* [PATCH][next] dmaengine: dw-axi-dmac: remove redundant null check on desc
@ 2021-02-03 13:46 Colin King
  2021-02-04  0:18 ` Sia, Jee Heng
  2021-02-08 12:10 ` Vinod Koul
  0 siblings, 2 replies; 4+ messages in thread
From: Colin King @ 2021-02-03 13:46 UTC (permalink / raw)
  To: Eugeniy Paltsev, Vinod Koul, Sia Jee Heng, Andy Shevchenko,
	dmaengine
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The pointer desc is being null checked twice, the second null check
is redundant because desc has not been re-assigned between the
checks. Remove the redundant second null check on desc.

Addresses-Coverity: ("Logically dead code")
Fixes: ef6fb2d6f1ab ("dmaengine: dw-axi-dmac: simplify descriptor management")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
index ac3d81b72a15..d9e4ac3edb4e 100644
--- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
+++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
@@ -919,10 +919,6 @@ dma_chan_prep_dma_memcpy(struct dma_chan *dchan, dma_addr_t dst_adr,
 		num++;
 	}
 
-	/* Total len of src/dest sg == 0, so no descriptor were allocated */
-	if (unlikely(!desc))
-		return NULL;
-
 	/* Set end-of-link to the last link descriptor of list */
 	set_desc_last(&desc->hw_desc[num - 1]);
 	/* Managed transfer list */
-- 
2.29.2


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

* RE: [PATCH][next] dmaengine: dw-axi-dmac: remove redundant null check on desc
  2021-02-03 13:46 [PATCH][next] dmaengine: dw-axi-dmac: remove redundant null check on desc Colin King
@ 2021-02-04  0:18 ` Sia, Jee Heng
  2021-02-08 12:09   ` Vinod Koul
  2021-02-08 12:10 ` Vinod Koul
  1 sibling, 1 reply; 4+ messages in thread
From: Sia, Jee Heng @ 2021-02-04  0:18 UTC (permalink / raw)
  To: Colin King, Eugeniy Paltsev, Vinod Koul, Andy Shevchenko,
	dmaengine@vger.kernel.org
  Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org

The code looks good to me. I have also verified it on Intel KeemBay platform.

Reviewed-by: Sia Jee Heng <jee.heng.sia@intel.com>
Tested-by: Sia Jee Heng <jee.heng.sia@intel.com>

Thanks
Regards
Jee Heng
> -----Original Message-----
> From: Colin King <colin.king@canonical.com>
> Sent: 03 February 2021 9:47 PM
> To: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>; Vinod Koul
> <vkoul@kernel.org>; Sia, Jee Heng <jee.heng.sia@intel.com>; Andy
> Shevchenko <andriy.shevchenko@linux.intel.com>;
> dmaengine@vger.kernel.org
> Cc: kernel-janitors@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: [PATCH][next] dmaengine: dw-axi-dmac: remove redundant
> null check on desc
> 
> From: Colin Ian King <colin.king@canonical.com>
> 
> The pointer desc is being null checked twice, the second null check is
> redundant because desc has not been re-assigned between the checks.
> Remove the redundant second null check on desc.
> 
> Addresses-Coverity: ("Logically dead code")
> Fixes: ef6fb2d6f1ab ("dmaengine: dw-axi-dmac: simplify descriptor
> management")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
> b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
> index ac3d81b72a15..d9e4ac3edb4e 100644
> --- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
> +++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
> @@ -919,10 +919,6 @@ dma_chan_prep_dma_memcpy(struct
> dma_chan *dchan, dma_addr_t dst_adr,
>  		num++;
>  	}
> 
> -	/* Total len of src/dest sg == 0, so no descriptor were
> allocated */
> -	if (unlikely(!desc))
> -		return NULL;
> -
>  	/* Set end-of-link to the last link descriptor of list */
>  	set_desc_last(&desc->hw_desc[num - 1]);
>  	/* Managed transfer list */
> --
> 2.29.2


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

* Re: [PATCH][next] dmaengine: dw-axi-dmac: remove redundant null check on desc
  2021-02-04  0:18 ` Sia, Jee Heng
@ 2021-02-08 12:09   ` Vinod Koul
  0 siblings, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2021-02-08 12:09 UTC (permalink / raw)
  To: Sia, Jee Heng
  Cc: Colin King, Eugeniy Paltsev, Andy Shevchenko,
	dmaengine@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org

On 04-02-21, 00:18, Sia, Jee Heng wrote:
> The code looks good to me. I have also verified it on Intel KeemBay platform.
> 
> Reviewed-by: Sia Jee Heng <jee.heng.sia@intel.com>
> Tested-by: Sia Jee Heng <jee.heng.sia@intel.com>

Please *do not* top post!

> 
> Thanks
> Regards
> Jee Heng
> > -----Original Message-----
> > From: Colin King <colin.king@canonical.com>
> > Sent: 03 February 2021 9:47 PM
> > To: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>; Vinod Koul
> > <vkoul@kernel.org>; Sia, Jee Heng <jee.heng.sia@intel.com>; Andy
> > Shevchenko <andriy.shevchenko@linux.intel.com>;
> > dmaengine@vger.kernel.org
> > Cc: kernel-janitors@vger.kernel.org; linux-kernel@vger.kernel.org
> > Subject: [PATCH][next] dmaengine: dw-axi-dmac: remove redundant
> > null check on desc
> > 
> > From: Colin Ian King <colin.king@canonical.com>
> > 
> > The pointer desc is being null checked twice, the second null check is
> > redundant because desc has not been re-assigned between the checks.
> > Remove the redundant second null check on desc.
> > 
> > Addresses-Coverity: ("Logically dead code")
> > Fixes: ef6fb2d6f1ab ("dmaengine: dw-axi-dmac: simplify descriptor
> > management")
> > Signed-off-by: Colin Ian King <colin.king@canonical.com>
> > ---
> >  drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 4 ----
> >  1 file changed, 4 deletions(-)
> > 
> > diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
> > b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
> > index ac3d81b72a15..d9e4ac3edb4e 100644
> > --- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
> > +++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
> > @@ -919,10 +919,6 @@ dma_chan_prep_dma_memcpy(struct
> > dma_chan *dchan, dma_addr_t dst_adr,
> >  		num++;
> >  	}
> > 
> > -	/* Total len of src/dest sg == 0, so no descriptor were
> > allocated */
> > -	if (unlikely(!desc))
> > -		return NULL;
> > -
> >  	/* Set end-of-link to the last link descriptor of list */
> >  	set_desc_last(&desc->hw_desc[num - 1]);
> >  	/* Managed transfer list */
> > --
> > 2.29.2
> 

-- 
~Vinod

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

* Re: [PATCH][next] dmaengine: dw-axi-dmac: remove redundant null check on desc
  2021-02-03 13:46 [PATCH][next] dmaengine: dw-axi-dmac: remove redundant null check on desc Colin King
  2021-02-04  0:18 ` Sia, Jee Heng
@ 2021-02-08 12:10 ` Vinod Koul
  1 sibling, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2021-02-08 12:10 UTC (permalink / raw)
  To: Colin King
  Cc: Eugeniy Paltsev, Sia Jee Heng, Andy Shevchenko, dmaengine,
	kernel-janitors, linux-kernel

On 03-02-21, 13:46, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The pointer desc is being null checked twice, the second null check
> is redundant because desc has not been re-assigned between the
> checks. Remove the redundant second null check on desc.

Applied, thanks

-- 
~Vinod

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

end of thread, other threads:[~2021-02-08 12:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-03 13:46 [PATCH][next] dmaengine: dw-axi-dmac: remove redundant null check on desc Colin King
2021-02-04  0:18 ` Sia, Jee Heng
2021-02-08 12:09   ` Vinod Koul
2021-02-08 12:10 ` Vinod Koul

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