net/bxnt: remove redundant null check
diff mbox series

Message ID 20200731023444.27986-1-gaurav1086@gmail.com
State Deferred
Delegated to: Ajit Khaparde
Headers show
Series
  • net/bxnt: remove redundant null check
Related show

Checks

Context Check Description
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/travis-robot success Travis build: passed
ci/Intel-compilation success Compilation OK
ci/iol-intel-Performance success Performance Testing PASS
ci/checkpatch success coding style OK

Commit Message

Gaurav Singh July 31, 2020, 2:34 a.m. UTC
vxlan_mask cannot be NULL since its already being accessed
before. Remove the redundant NULL check.

Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
---
 drivers/net/bnxt/bnxt_flow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ajit Khaparde July 31, 2020, 5:03 a.m. UTC | #1
On Thu, Jul 30, 2020 at 7:35 PM Gaurav Singh <gaurav1086@gmail.com> wrote:

> vxlan_mask cannot be NULL since its already being accessed
> before. Remove the redundant NULL check.
>
> Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>


> ---
>  drivers/net/bnxt/bnxt_flow.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c
> index 320b53d94..33a074387 100644
> --- a/drivers/net/bnxt/bnxt_flow.c
> +++ b/drivers/net/bnxt/bnxt_flow.c
> @@ -554,7 +554,7 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp,
>                         }
>
>                         /* Check if VNI is masked. */
> -                       if (vxlan_spec && vxlan_mask) {
> +                       if (vxlan_mask) {
>                                 vni_masked =
>                                         !!memcmp(vxlan_mask->vni, vni_mask,
>                                                  RTE_DIM(vni_mask));
> --
> 2.17.1
>
>
Thomas Monjalon Aug. 5, 2020, 8:11 p.m. UTC | #2
31/07/2020 07:03, Ajit Khaparde:
> On Thu, Jul 30, 2020 at 7:35 PM Gaurav Singh <gaurav1086@gmail.com> wrote:
> 
> > vxlan_mask cannot be NULL since its already being accessed
> > before. Remove the redundant NULL check.

Do you mean vxlan_spec?

> > Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
> >
> Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>

The title has a typo: bxnt

> >                         /* Check if VNI is masked. */
> > -                       if (vxlan_spec && vxlan_mask) {
> > +                       if (vxlan_mask) {

This kind of implicit check is against the coding style.
Except for boolean variables, we should use == or !=

Ajit, please check details when reviewing, thanks.

Patch
diff mbox series

diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c
index 320b53d94..33a074387 100644
--- a/drivers/net/bnxt/bnxt_flow.c
+++ b/drivers/net/bnxt/bnxt_flow.c
@@ -554,7 +554,7 @@  bnxt_validate_and_parse_flow_type(struct bnxt *bp,
 			}
 
 			/* Check if VNI is masked. */
-			if (vxlan_spec && vxlan_mask) {
+			if (vxlan_mask) {
 				vni_masked =
 					!!memcmp(vxlan_mask->vni, vni_mask,
 						 RTE_DIM(vni_mask));