Skip to contentSkip to conversation

net/bxnt: remove redundant null check

PATCH In review Gaurav Singh 3 participants 6 messages Jul 31, 2020 – Sep 2, 2020 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/bxnt: remove redundant null check

vxlan_mask cannot be NULL since its already being accessed before. Remove the redundant NULL check.

---
 drivers/net/bnxt/bnxt_flow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/bnxt_flow.c +1 -1
index 320b53d94..33a074387 100644
@@ -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));
Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Gaurav Singh

vxlan_mask cannot be NULL since its already being accessed before. Remove the redundant NULL check.

Quoted 21 lines
---
 drivers/net/bnxt/bnxt_flow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/bnxt_flow.c +1 -2
index 320b53d94..33a074387 100644
@@ -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

#2 lore raw

31/07/2020 07:03, Ajit Khaparde:

Quoted 4 lines · Gaurav Singh
Quoted 3 lines

vxlan_mask cannot be NULL since its already being accessed before. Remove the redundant NULL check.

Do you mean vxlan_spec?

Quoted 3 lines
Quoted 2 lines

The title has a typo: bxnt

Quoted 3 lines

drivers/net/bnxt/bnxt_flow.c bnxt_validate_and_parse_flow_type(struct bnxt *bp, · line 557

Quoted 3 lines
                        /* Check if VNI is masked. */
drivers/net/bnxt/bnxt_flow.c +1 -1
-                       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.

#3 lore raw

PATCH 1/1 net/bnxt: remove redundant null check in bnxt_validate_and_parse_flow_type

vxlan_spec cannot be NULL since its already being accessed before. Remove the redundant NULL check.

---
 drivers/net/bnxt/bnxt_flow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/bnxt_flow.c +1 -1
index 320b53d94..c1c59bbe5 100644
@@ -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 != NULL) {
 				vni_masked =
 					!!memcmp(vxlan_mask->vni, vni_mask,
 						 RTE_DIM(vni_mask));
Signature · 1 line
2.17.1
#4 lore raw

PATCH 1/1 net/bnxt: remove redundant null check in bnxt_validate_and_parse_flow_type

In reply to Gaurav Singh

vxlan_spec cannot be NULL since its already being accessed before. Remove the redundant NULL check.

---
 drivers/net/bnxt/bnxt_flow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/bnxt_flow.c +1 -1
index 320b53d94..c1c59bbe5 100644
@@ -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 != NULL) {
 				vni_masked =
 					!!memcmp(vxlan_mask->vni, vni_mask,
 						 RTE_DIM(vni_mask));
Signature · 1 line
2.17.1
#5 lore raw

Re: [dpdk-dev] [PATCH] net/bnxt: remove redundant null check in bnxt_validate_and_parse_flow_type

Quoted 5 lines · Gaurav Singh

vxlan_spec cannot be NULL since its already being accessed before. Remove the redundant NULL check.

Patch applied to dpdk-next-net-brcm. Thanks

Quoted 21 lines
---
 drivers/net/bnxt/bnxt_flow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/bnxt_flow.c +1 -2
index 320b53d94..c1c59bbe5 100644
@@ -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 != NULL) {
                                vni_masked =
                                        !!memcmp(vxlan_mask->vni, vni_mask,
                                                 RTE_DIM(vni_mask));
--

2.17.1