From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
Kishore Padmanabha <kishore.padmanabha@broadcom.com>,
Ajit Khaparde <ajit.khaparde@broadcom.com>
Subject: [PATCH 2/4] net/bnxt: remove unnecessary null check
Date: Wed, 1 Apr 2026 09:40:23 -0700 [thread overview]
Message-ID: <20260401164108.201404-3-stephen@networkplumber.org> (raw)
In-Reply-To: <20260401164108.201404-1-stephen@networkplumber.org>
No need to check for null before calling free.
Found by coccinelle script null_free.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/bnxt/tf_core/v3/tfo.c | 6 ++----
drivers/net/bnxt/tf_ulp/ulp_sc_mgr.c | 6 ++----
2 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/net/bnxt/tf_core/v3/tfo.c b/drivers/net/bnxt/tf_core/v3/tfo.c
index 4b1f545476..681d1dd8d3 100644
--- a/drivers/net/bnxt/tf_core/v3/tfo.c
+++ b/drivers/net/bnxt/tf_core/v3/tfo.c
@@ -183,13 +183,11 @@ void tfo_close(void **tfo)
}
}
}
- if (tim)
- rte_free(tim);
+ rte_free(tim);
tfco->ts_tim = NULL;
tfco->tfgo = NULL;
- if (*tfo)
- rte_free(*tfo);
+ rte_free(*tfo);
*tfo = NULL;
}
}
diff --git a/drivers/net/bnxt/tf_ulp/ulp_sc_mgr.c b/drivers/net/bnxt/tf_ulp/ulp_sc_mgr.c
index 23e1b59ca4..3707cd1a2d 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_sc_mgr.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_sc_mgr.c
@@ -169,11 +169,9 @@ ulp_sc_mgr_deinit(struct bnxt_ulp_context *ctxt)
ulp_sc_mgr_thread_cancel(ctxt);
- if (ulp_sc_info->stats_cache_tbl)
- rte_free(ulp_sc_info->stats_cache_tbl);
+ rte_free(ulp_sc_info->stats_cache_tbl);
- if (ulp_sc_info->read_data)
- rte_free(ulp_sc_info->read_data);
+ rte_free(ulp_sc_info->read_data);
rte_free(ulp_sc_info);
--
2.53.0
next prev parent reply other threads:[~2026-04-01 16:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-01 16:40 [PATCH 0/4] remove useless null checks before free Stephen Hemminger
2026-04-01 16:40 ` [PATCH 1/4] net/ice: remove unnecessary null check Stephen Hemminger
2026-04-01 16:44 ` Bruce Richardson
2026-04-01 16:40 ` Stephen Hemminger [this message]
2026-04-01 16:40 ` [PATCH 3/4] net/zxdh: " Stephen Hemminger
2026-04-12 16:22 ` Stephen Hemminger
2026-04-01 16:40 ` [PATCH 4/4] app/test_compress: " Stephen Hemminger
2026-06-03 19:51 ` [PATCH 0/4] remove useless null checks before free 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=20260401164108.201404-3-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=ajit.khaparde@broadcom.com \
--cc=dev@dpdk.org \
--cc=kishore.padmanabha@broadcom.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.