2021-02-03 13:52:16

by Colin King

[permalink] [raw]
Subject: [PATCH][next] dmaengine: dw-axi-dmac: remove redundant null check on desc

From: Colin Ian King <[email protected]>

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 <[email protected]>
---
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


2021-02-04 00:24:23

by Sia Jee Heng

[permalink] [raw]
Subject: RE: [PATCH][next] dmaengine: dw-axi-dmac: remove redundant null check on desc

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

Reviewed-by: Sia Jee Heng <[email protected]>
Tested-by: Sia Jee Heng <[email protected]>

Thanks
Regards
Jee Heng
> -----Original Message-----
> From: Colin King <[email protected]>
> Sent: 03 February 2021 9:47 PM
> To: Eugeniy Paltsev <[email protected]>; Vinod Koul
> <[email protected]>; Sia, Jee Heng <[email protected]>; Andy
> Shevchenko <[email protected]>;
> [email protected]
> Cc: [email protected]; [email protected]
> Subject: [PATCH][next] dmaengine: dw-axi-dmac: remove redundant
> null check on desc
>
> From: Colin Ian King <[email protected]>
>
> 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 <[email protected]>
> ---
> 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

2021-02-08 12:28:52

by Vinod Koul

[permalink] [raw]
Subject: Re: [PATCH][next] dmaengine: dw-axi-dmac: remove redundant null check on desc

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 <[email protected]>
> Tested-by: Sia Jee Heng <[email protected]>

Please *do not* top post!

>
> Thanks
> Regards
> Jee Heng
> > -----Original Message-----
> > From: Colin King <[email protected]>
> > Sent: 03 February 2021 9:47 PM
> > To: Eugeniy Paltsev <[email protected]>; Vinod Koul
> > <[email protected]>; Sia, Jee Heng <[email protected]>; Andy
> > Shevchenko <[email protected]>;
> > [email protected]
> > Cc: [email protected]; [email protected]
> > Subject: [PATCH][next] dmaengine: dw-axi-dmac: remove redundant
> > null check on desc
> >
> > From: Colin Ian King <[email protected]>
> >
> > 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 <[email protected]>
> > ---
> > 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

2021-02-08 12:31:01

by Vinod Koul

[permalink] [raw]
Subject: Re: [PATCH][next] dmaengine: dw-axi-dmac: remove redundant null check on desc

On 03-02-21, 13:46, Colin King wrote:
> From: Colin Ian King <[email protected]>
>
> 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