diff mbox series

[5/9] net/ipn3ke: remove useless if statement

Message ID 20191001130405.7076-4-ktraynor@redhat.com (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers show
Series Coverity fixes and other cleanups | expand

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Kevin Traynor Oct. 1, 2019, 1:04 p.m. UTC
Coverity complains that this statement is not needed as the goto
label is on the next line anyway. Remove the if statement.

653        ret = ipn3ke_cfg_parse_i40e_pf_ethdev(afu_name, pf_name);
   CID 337930 (#1 of 1): Identical code for different branches
   (IDENTICAL_BRANCHES)identical_branches: The same code is executed
   when the condition ret is true or false, because the code in the
   if-then branch and after the if statement is identical. Should
   the if statement be removed?
654        if (ret)
655                goto end;
   implicit_else: The code from the above if-then branch is identical
   to the code after the if statement.
656end:

Coverity issue: 337930
Fixes: c01c748e4ae6 ("net/ipn3ke: add new driver")
Cc: rosen.xu@intel.com
Cc: stable@dpdk.org

Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
---
 drivers/net/ipn3ke/ipn3ke_ethdev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

David Marchand Oct. 30, 2019, 8:01 a.m. UTC | #1
On Tue, Oct 1, 2019 at 3:04 PM Kevin Traynor <ktraynor@redhat.com> wrote:
>
> Coverity complains that this statement is not needed as the goto
> label is on the next line anyway. Remove the if statement.
>
> 653        ret = ipn3ke_cfg_parse_i40e_pf_ethdev(afu_name, pf_name);
>    CID 337930 (#1 of 1): Identical code for different branches
>    (IDENTICAL_BRANCHES)identical_branches: The same code is executed
>    when the condition ret is true or false, because the code in the
>    if-then branch and after the if statement is identical. Should
>    the if statement be removed?
> 654        if (ret)
> 655                goto end;
>    implicit_else: The code from the above if-then branch is identical
>    to the code after the if statement.
> 656end:
>
> Coverity issue: 337930
> Fixes: c01c748e4ae6 ("net/ipn3ke: add new driver")
> Cc: rosen.xu@intel.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
> ---
>  drivers/net/ipn3ke/ipn3ke_ethdev.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.c b/drivers/net/ipn3ke/ipn3ke_ethdev.c
> index c226d6313..282295f49 100644
> --- a/drivers/net/ipn3ke/ipn3ke_ethdev.c
> +++ b/drivers/net/ipn3ke/ipn3ke_ethdev.c
> @@ -652,6 +652,5 @@ ipn3ke_cfg_probe(struct rte_vdev_device *dev)
>
>         ret = ipn3ke_cfg_parse_i40e_pf_ethdev(afu_name, pf_name);
> -       if (ret)
> -               goto end;
> +
>  end:
>         if (kvlist)
> --
> 2.21.0
>

Reviewed-by: David Marchand <david.marchand@redhat.com>
Xu, Rosen Nov. 8, 2019, 2:35 p.m. UTC | #2
> -----Original Message-----
> From: David Marchand [mailto:david.marchand@redhat.com]
> Sent: Wednesday, October 30, 2019 16:01
> To: Kevin Traynor <ktraynor@redhat.com>
> Cc: dev <dev@dpdk.org>; Xu, Rosen <rosen.xu@intel.com>; dpdk stable
> <stable@dpdk.org>
> Subject: Re: [dpdk-stable] [PATCH 5/9] net/ipn3ke: remove useless if
> statement
> 
> On Tue, Oct 1, 2019 at 3:04 PM Kevin Traynor <ktraynor@redhat.com> wrote:
> >
> > Coverity complains that this statement is not needed as the goto label
> > is on the next line anyway. Remove the if statement.
> >
> > 653        ret = ipn3ke_cfg_parse_i40e_pf_ethdev(afu_name, pf_name);
> >    CID 337930 (#1 of 1): Identical code for different branches
> >    (IDENTICAL_BRANCHES)identical_branches: The same code is executed
> >    when the condition ret is true or false, because the code in the
> >    if-then branch and after the if statement is identical. Should
> >    the if statement be removed?
> > 654        if (ret)
> > 655                goto end;
> >    implicit_else: The code from the above if-then branch is identical
> >    to the code after the if statement.
> > 656end:
> >
> > Coverity issue: 337930
> > Fixes: c01c748e4ae6 ("net/ipn3ke: add new driver")
> > Cc: rosen.xu@intel.com
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
> > ---
> >  drivers/net/ipn3ke/ipn3ke_ethdev.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.c
> > b/drivers/net/ipn3ke/ipn3ke_ethdev.c
> > index c226d6313..282295f49 100644
> > --- a/drivers/net/ipn3ke/ipn3ke_ethdev.c
> > +++ b/drivers/net/ipn3ke/ipn3ke_ethdev.c
> > @@ -652,6 +652,5 @@ ipn3ke_cfg_probe(struct rte_vdev_device *dev)
> >
> >         ret = ipn3ke_cfg_parse_i40e_pf_ethdev(afu_name, pf_name);
> > -       if (ret)
> > -               goto end;
> > +
> >  end:
> >         if (kvlist)
> > --
> > 2.21.0
> >
> 
> Reviewed-by: David Marchand <david.marchand@redhat.com>
> 
> --
> David Marchand

Reviewed-by: Rosen Xu <rosen.xu@intel.com>
Xu, Rosen Nov. 8, 2019, 2:52 p.m. UTC | #3
Hi,

> -----Original Message-----
> From: Kevin Traynor [mailto:ktraynor@redhat.com]
> Sent: Tuesday, October 01, 2019 21:04
> To: dev@dpdk.org
> Cc: Kevin Traynor <ktraynor@redhat.com>; Xu, Rosen
> <rosen.xu@intel.com>; stable@dpdk.org
> Subject: [PATCH 5/9] net/ipn3ke: remove useless if statement
> 
> Coverity complains that this statement is not needed as the goto label is on
> the next line anyway. Remove the if statement.
> 
> 653        ret = ipn3ke_cfg_parse_i40e_pf_ethdev(afu_name, pf_name);
>    CID 337930 (#1 of 1): Identical code for different branches
>    (IDENTICAL_BRANCHES)identical_branches: The same code is executed
>    when the condition ret is true or false, because the code in the
>    if-then branch and after the if statement is identical. Should
>    the if statement be removed?
> 654        if (ret)
> 655                goto end;
>    implicit_else: The code from the above if-then branch is identical
>    to the code after the if statement.
> 656end:
> 
> Coverity issue: 337930
> Fixes: c01c748e4ae6 ("net/ipn3ke: add new driver")
> Cc: rosen.xu@intel.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
> ---
>  drivers/net/ipn3ke/ipn3ke_ethdev.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.c
> b/drivers/net/ipn3ke/ipn3ke_ethdev.c
> index c226d6313..282295f49 100644
> --- a/drivers/net/ipn3ke/ipn3ke_ethdev.c
> +++ b/drivers/net/ipn3ke/ipn3ke_ethdev.c
> @@ -652,6 +652,5 @@ ipn3ke_cfg_probe(struct rte_vdev_device *dev)
> 
>  	ret = ipn3ke_cfg_parse_i40e_pf_ethdev(afu_name, pf_name);
> -	if (ret)
> -		goto end;
> +
>  end:
>  	if (kvlist)
> --
> 2.21.0

Reviewed-by: Rosen Xu <rosen.xu@intel.com>
diff mbox series

Patch

diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.c b/drivers/net/ipn3ke/ipn3ke_ethdev.c
index c226d6313..282295f49 100644
--- a/drivers/net/ipn3ke/ipn3ke_ethdev.c
+++ b/drivers/net/ipn3ke/ipn3ke_ethdev.c
@@ -652,6 +652,5 @@  ipn3ke_cfg_probe(struct rte_vdev_device *dev)
 
 	ret = ipn3ke_cfg_parse_i40e_pf_ethdev(afu_name, pf_name);
-	if (ret)
-		goto end;
+
 end:
 	if (kvlist)