From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
Matan Azrad <matan@nvidia.com>,
Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Subject: [PATCH 2/4] mlx5: remove unnecessary null checks
Date: Wed, 9 Nov 2022 15:46:47 -0800 [thread overview]
Message-ID: <20221109234649.331942-3-stephen@networkplumber.org> (raw)
In-Reply-To: <20221109234649.331942-1-stephen@networkplumber.org>
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
next prev parent reply other threads:[~2022-11-09 23:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-09 23:46 [PATCH 0/4] " Stephen Hemminger
2022-11-09 23:46 ` [PATCH 1/4] gve: " Stephen Hemminger
2022-11-09 23:46 ` Stephen Hemminger [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221109234649.331942-3-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=matan@nvidia.com \
--cc=viacheslavo@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).