* [PATCH 0/4] remove unnecessary null checks
@ 2022-11-09 23:46 Stephen Hemminger
2022-11-09 23:46 ` [PATCH 1/4] gve: " Stephen Hemminger
` (4 more replies)
0 siblings, 5 replies; 9+ messages in thread
From: Stephen Hemminger @ 2022-11-09 23:46 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger
This patch set is from running the null_free coccinelle
script on the current main branch.
Stephen Hemminger (4):
gve: remove unnecessary null checks
mlx5: remove unnecessary null checks
idpf: remove unnecessary null checks
examples: remove unnecessary null checks
drivers/net/gve/gve_ethdev.c | 6 ++----
drivers/net/idpf/idpf_rxtx.c | 3 +--
drivers/net/mlx5/hws/mlx5dr_pool.c | 3 +--
drivers/net/mlx5/mlx5_flow_hw.c | 6 ++----
examples/distributor/main.c | 3 +--
examples/fips_validation/main.c | 15 +++++----------
6 files changed, 12 insertions(+), 24 deletions(-)
--
2.35.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/4] gve: remove unnecessary null checks
2022-11-09 23:46 [PATCH 0/4] remove unnecessary null checks Stephen Hemminger
@ 2022-11-09 23:46 ` Stephen Hemminger
2022-11-09 23:46 ` [PATCH 2/4] mlx5: " Stephen Hemminger
` (3 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Stephen Hemminger @ 2022-11-09 23:46 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Junfeng Guo
The function rte_free() already handles NULL argument;
therefore the checks in this code are unnecessary.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/gve/gve_ethdev.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/net/gve/gve_ethdev.c b/drivers/net/gve/gve_ethdev.c
index 0086162f63b3..a05e61feba1f 100644
--- a/drivers/net/gve/gve_ethdev.c
+++ b/drivers/net/gve/gve_ethdev.c
@@ -81,12 +81,10 @@ gve_free_qpls(struct gve_priv *priv)
for (i = 0; i < nb_txqs + nb_rxqs; i++) {
if (priv->qpl[i].mz != NULL)
rte_memzone_free(priv->qpl[i].mz);
- if (priv->qpl[i].page_buses != NULL)
- rte_free(priv->qpl[i].page_buses);
+ rte_free(priv->qpl[i].page_buses);
}
- if (priv->qpl != NULL)
- rte_free(priv->qpl);
+ rte_free(priv->qpl);
}
static int
--
2.35.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/4] mlx5: remove unnecessary null checks
2022-11-09 23:46 [PATCH 0/4] remove unnecessary null checks Stephen Hemminger
2022-11-09 23:46 ` [PATCH 1/4] gve: " Stephen Hemminger
@ 2022-11-09 23:46 ` Stephen Hemminger
2022-11-09 23:46 ` [PATCH 3/4] idpf: remvoee " Stephen Hemminger
` (2 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Stephen Hemminger @ 2022-11-09 23:46 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Matan Azrad, Viacheslav Ovsiienko
The function rte_free() already handles NULL argument;
therefore the checks in this code are unnecessary.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/mlx5/hws/mlx5dr_pool.c | 3 +--
drivers/net/mlx5/mlx5_flow_hw.c | 6 ++----
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/net/mlx5/hws/mlx5dr_pool.c b/drivers/net/mlx5/hws/mlx5dr_pool.c
index 2bfda5b4a5be..fdbd3d438d08 100644
--- a/drivers/net/mlx5/hws/mlx5dr_pool.c
+++ b/drivers/net/mlx5/hws/mlx5dr_pool.c
@@ -537,8 +537,7 @@ static void mlx5dr_onesize_element_db_uninit(struct mlx5dr_pool *pool)
for (i = 0; i < MLX5DR_POOL_RESOURCE_ARR_SZ; i++) {
elem = pool->db.element_manager->elements[i];
if (elem) {
- if (elem->bitmap)
- rte_free(elem->bitmap);
+ rte_free(elem->bitmap);
simple_free(elem);
pool->db.element_manager->elements[i] = NULL;
}
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index 2d275ad11127..bea7805ee267 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -7063,10 +7063,8 @@ flow_hw_configure(struct rte_eth_dev *dev,
if (dr_ctx)
claim_zero(mlx5dr_context_close(dr_ctx));
for (i = 0; i < nb_q_updated; i++) {
- if (priv->hw_q[i].indir_iq)
- rte_ring_free(priv->hw_q[i].indir_iq);
- if (priv->hw_q[i].indir_cq)
- rte_ring_free(priv->hw_q[i].indir_cq);
+ rte_ring_free(priv->hw_q[i].indir_iq);
+ rte_ring_free(priv->hw_q[i].indir_cq);
}
mlx5_free(priv->hw_q);
priv->hw_q = NULL;
--
2.35.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 3/4] idpf: remvoee unnecessary null checks
2022-11-09 23:46 [PATCH 0/4] remove unnecessary null checks Stephen Hemminger
2022-11-09 23:46 ` [PATCH 1/4] gve: " Stephen Hemminger
2022-11-09 23:46 ` [PATCH 2/4] mlx5: " Stephen Hemminger
@ 2022-11-09 23:46 ` Stephen Hemminger
2022-11-09 23:46 ` [PATCH 4/4] examples: remove " Stephen Hemminger
2022-11-15 14:03 ` [PATCH 0/4] " Thomas Monjalon
4 siblings, 0 replies; 9+ messages in thread
From: Stephen Hemminger @ 2022-11-09 23:46 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Jingjing Wu, Beilei Xing
The function rte_free() already handles NULL argument;
therefore the checks in this code are unnecessary.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/idpf/idpf_rxtx.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/idpf/idpf_rxtx.c b/drivers/net/idpf/idpf_rxtx.c
index bafa007faf85..b1f58089e031 100644
--- a/drivers/net/idpf/idpf_rxtx.c
+++ b/drivers/net/idpf/idpf_rxtx.c
@@ -251,8 +251,7 @@ reset_single_rx_queue(struct idpf_rx_queue *rxq)
rxq->rx_tail = 0;
rxq->nb_rx_hold = 0;
- if (rxq->pkt_first_seg != NULL)
- rte_pktmbuf_free(rxq->pkt_first_seg);
+ rte_pktmbuf_free(rxq->pkt_first_seg);
rxq->pkt_first_seg = NULL;
rxq->pkt_last_seg = NULL;
--
2.35.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 4/4] examples: remove unnecessary null checks
2022-11-09 23:46 [PATCH 0/4] remove unnecessary null checks Stephen Hemminger
` (2 preceding siblings ...)
2022-11-09 23:46 ` [PATCH 3/4] idpf: remvoee " Stephen Hemminger
@ 2022-11-09 23:46 ` Stephen Hemminger
2022-11-14 15:43 ` Dooley, Brian
2022-11-15 14:03 ` [PATCH 0/4] " Thomas Monjalon
4 siblings, 1 reply; 9+ messages in thread
From: Stephen Hemminger @ 2022-11-09 23:46 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, David Hunt, Brian Dooley
The function rte_free() already handles NULL argument;
therefore the checks in this code are unnecessary.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
examples/distributor/main.c | 3 +--
examples/fips_validation/main.c | 15 +++++----------
2 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/examples/distributor/main.c b/examples/distributor/main.c
index e767973ed8de..21304d661873 100644
--- a/examples/distributor/main.c
+++ b/examples/distributor/main.c
@@ -1017,8 +1017,7 @@ main(int argc, char *argv[])
print_stats();
- if (pd)
- rte_free(pd);
+ rte_free(pd);
rte_free(pr);
/* clean up the EAL */
diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c
index 40a5b70e073b..73caaffb7e7a 100644
--- a/examples/fips_validation/main.c
+++ b/examples/fips_validation/main.c
@@ -962,8 +962,7 @@ prepare_rsa_op(void)
asym->rsa.message.data = msg.val;
asym->rsa.message.length = msg.len;
- if (vec.rsa.signature.val)
- rte_free(vec.rsa.signature.val);
+ rte_free(vec.rsa.signature.val);
vec.rsa.signature.val = rte_zmalloc(NULL, vec.rsa.n.len, 0);
vec.rsa.signature.len = vec.rsa.n.len;
@@ -1011,11 +1010,9 @@ prepare_ecdsa_op(void)
asym->ecdsa.k.data = vec.ecdsa.k.val;
asym->ecdsa.k.length = vec.ecdsa.k.len;
- if (vec.ecdsa.r.val)
- rte_free(vec.ecdsa.r.val);
+ rte_free(vec.ecdsa.r.val);
- if (vec.ecdsa.s.val)
- rte_free(vec.ecdsa.s.val);
+ rte_free(vec.ecdsa.s.val);
vec.ecdsa.r.len = info.interim_info.ecdsa_data.curve_len;
vec.ecdsa.r.val = rte_zmalloc(NULL, vec.ecdsa.r.len, 0);
@@ -1060,11 +1057,9 @@ prepare_ecfpm_op(void)
asym->ecpm.scalar.data = vec.ecdsa.pkey.val;
asym->ecpm.scalar.length = vec.ecdsa.pkey.len;
- if (vec.ecdsa.qx.val)
- rte_free(vec.ecdsa.qx.val);
+ rte_free(vec.ecdsa.qx.val);
- if (vec.ecdsa.qy.val)
- rte_free(vec.ecdsa.qy.val);
+ rte_free(vec.ecdsa.qy.val);
vec.ecdsa.qx.len = info.interim_info.ecdsa_data.curve_len;
vec.ecdsa.qx.val = rte_zmalloc(NULL, vec.ecdsa.qx.len, 0);
--
2.35.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH 4/4] examples: remove unnecessary null checks
2022-11-09 23:46 ` [PATCH 4/4] examples: remove " Stephen Hemminger
@ 2022-11-14 15:43 ` Dooley, Brian
0 siblings, 0 replies; 9+ messages in thread
From: Dooley, Brian @ 2022-11-14 15:43 UTC (permalink / raw)
To: Stephen Hemminger, dev; +Cc: Hunt, David
Hi Stephen,
Looks good for fips validation.
> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Wednesday, November 9, 2022 11:47 PM
> To: dev@dpdk.org
> Cc: Stephen Hemminger <stephen@networkplumber.org>; Hunt, David
> <david.hunt@intel.com>; Dooley, Brian <brian.dooley@intel.com>
> Subject: [PATCH 4/4] examples: remove unnecessary null checks
>
> The function rte_free() already handles NULL argument; therefore the
> checks in this code are unnecessary.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> examples/distributor/main.c | 3 +--
> examples/fips_validation/main.c | 15 +++++----------
> 2 files changed, 6 insertions(+), 12 deletions(-)
>
> diff --git a/examples/distributor/main.c b/examples/distributor/main.c index
> e767973ed8de..21304d661873 100644
> --- a/examples/distributor/main.c
> +++ b/examples/distributor/main.c
> @@ -1017,8 +1017,7 @@ main(int argc, char *argv[])
>
> print_stats();
>
> - if (pd)
> - rte_free(pd);
> + rte_free(pd);
> rte_free(pr);
>
> /* clean up the EAL */
> diff --git a/examples/fips_validation/main.c
> b/examples/fips_validation/main.c index 40a5b70e073b..73caaffb7e7a
> 100644
> --- a/examples/fips_validation/main.c
> +++ b/examples/fips_validation/main.c
> @@ -962,8 +962,7 @@ prepare_rsa_op(void)
> asym->rsa.message.data = msg.val;
> asym->rsa.message.length = msg.len;
>
> - if (vec.rsa.signature.val)
> - rte_free(vec.rsa.signature.val);
> + rte_free(vec.rsa.signature.val);
>
> vec.rsa.signature.val = rte_zmalloc(NULL, vec.rsa.n.len, 0);
> vec.rsa.signature.len = vec.rsa.n.len; @@ -1011,11 +1010,9
> @@ prepare_ecdsa_op(void)
> asym->ecdsa.k.data = vec.ecdsa.k.val;
> asym->ecdsa.k.length = vec.ecdsa.k.len;
>
> - if (vec.ecdsa.r.val)
> - rte_free(vec.ecdsa.r.val);
> + rte_free(vec.ecdsa.r.val);
>
> - if (vec.ecdsa.s.val)
> - rte_free(vec.ecdsa.s.val);
> + rte_free(vec.ecdsa.s.val);
>
> vec.ecdsa.r.len = info.interim_info.ecdsa_data.curve_len;
> vec.ecdsa.r.val = rte_zmalloc(NULL, vec.ecdsa.r.len, 0); @@ -
> 1060,11 +1057,9 @@ prepare_ecfpm_op(void)
> asym->ecpm.scalar.data = vec.ecdsa.pkey.val;
> asym->ecpm.scalar.length = vec.ecdsa.pkey.len;
>
> - if (vec.ecdsa.qx.val)
> - rte_free(vec.ecdsa.qx.val);
> + rte_free(vec.ecdsa.qx.val);
>
> - if (vec.ecdsa.qy.val)
> - rte_free(vec.ecdsa.qy.val);
> + rte_free(vec.ecdsa.qy.val);
>
> vec.ecdsa.qx.len = info.interim_info.ecdsa_data.curve_len;
> vec.ecdsa.qx.val = rte_zmalloc(NULL, vec.ecdsa.qx.len, 0);
> --
> 2.35.1
Acked-by: Brian Dooley <brian.dooley@intel.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/4] remove unnecessary null checks
2022-11-09 23:46 [PATCH 0/4] remove unnecessary null checks Stephen Hemminger
` (3 preceding siblings ...)
2022-11-09 23:46 ` [PATCH 4/4] examples: remove " Stephen Hemminger
@ 2022-11-15 14:03 ` Thomas Monjalon
2022-11-15 16:46 ` Stephen Hemminger
4 siblings, 1 reply; 9+ messages in thread
From: Thomas Monjalon @ 2022-11-15 14:03 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev
10/11/2022 00:46, Stephen Hemminger:
> This patch set is from running the null_free coccinelle
> script on the current main branch.
>
> Stephen Hemminger (4):
> gve: remove unnecessary null checks
> mlx5: remove unnecessary null checks
> idpf: remove unnecessary null checks
> examples: remove unnecessary null checks
Squashed drivers together and applied, thanks.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/4] remove unnecessary null checks
2022-11-15 14:03 ` [PATCH 0/4] " Thomas Monjalon
@ 2022-11-15 16:46 ` Stephen Hemminger
2022-11-15 17:23 ` Thomas Monjalon
0 siblings, 1 reply; 9+ messages in thread
From: Stephen Hemminger @ 2022-11-15 16:46 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev
On Tue, 15 Nov 2022 15:03:14 +0100
Thomas Monjalon <thomas@monjalon.net> wrote:
> 10/11/2022 00:46, Stephen Hemminger:
> > This patch set is from running the null_free coccinelle
> > script on the current main branch.
> >
> > Stephen Hemminger (4):
> > gve: remove unnecessary null checks
> > mlx5: remove unnecessary null checks
> > idpf: remove unnecessary null checks
> > examples: remove unnecessary null checks
>
> Squashed drivers together and applied, thanks.
Thanks, I tend to split driver patches so each maintainer only has to see
their own code.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/4] remove unnecessary null checks
2022-11-15 16:46 ` Stephen Hemminger
@ 2022-11-15 17:23 ` Thomas Monjalon
0 siblings, 0 replies; 9+ messages in thread
From: Thomas Monjalon @ 2022-11-15 17:23 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev
15/11/2022 17:46, Stephen Hemminger:
> On Tue, 15 Nov 2022 15:03:14 +0100
> Thomas Monjalon <thomas@monjalon.net> wrote:
>
> > 10/11/2022 00:46, Stephen Hemminger:
> > > This patch set is from running the null_free coccinelle
> > > script on the current main branch.
> > >
> > > Stephen Hemminger (4):
> > > gve: remove unnecessary null checks
> > > mlx5: remove unnecessary null checks
> > > idpf: remove unnecessary null checks
> > > examples: remove unnecessary null checks
> >
> > Squashed drivers together and applied, thanks.
>
> Thanks, I tend to split driver patches so each maintainer only has to see
> their own code.
Yes I know the intent, no problem.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2022-11-15 17:23 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-09 23:46 [PATCH 0/4] remove unnecessary null checks Stephen Hemminger
2022-11-09 23:46 ` [PATCH 1/4] gve: " Stephen Hemminger
2022-11-09 23:46 ` [PATCH 2/4] mlx5: " Stephen Hemminger
2022-11-09 23:46 ` [PATCH 3/4] idpf: remvoee " Stephen Hemminger
2022-11-09 23:46 ` [PATCH 4/4] examples: remove " Stephen Hemminger
2022-11-14 15:43 ` Dooley, Brian
2022-11-15 14:03 ` [PATCH 0/4] " Thomas Monjalon
2022-11-15 16:46 ` Stephen Hemminger
2022-11-15 17:23 ` Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).