diff mbox series

[v2,04/83] eal/windows: remove unnecessary NULL checks before free

Message ID 20220124174719.14417-5-stephen@networkplumber.org (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers show
Series remove unnecessary null checks | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger Jan. 24, 2022, 5:46 p.m. UTC
Calling free/rte_free/rte_mempool_free,... with NULL pointer
is allowed; so remove unnecessary NULL checks.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/eal/windows/eal_alarm.c  | 3 +--
 lib/eal/windows/eal_memory.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/lib/eal/windows/eal_alarm.c b/lib/eal/windows/eal_alarm.c
index 103c1f909da3..51fe752c16d4 100644
--- a/lib/eal/windows/eal_alarm.c
+++ b/lib/eal/windows/eal_alarm.c
@@ -162,8 +162,7 @@  rte_eal_alarm_set(uint64_t us, rte_eal_alarm_callback cb_fn, void *cb_arg)
 fail:
 	if (timer != NULL)
 		CloseHandle(timer);
-	if (ap != NULL)
-		free(ap);
+	free(ap);
 
 exit:
 	rte_eal_trace_alarm_set(us, cb_fn, cb_arg, ret);
diff --git a/lib/eal/windows/eal_memory.c b/lib/eal/windows/eal_memory.c
index 2fd37d97085e..215d768e2c57 100644
--- a/lib/eal/windows/eal_memory.c
+++ b/lib/eal/windows/eal_memory.c
@@ -190,8 +190,7 @@  eal_mem_virt2iova_init(void)
 	ret = 0;
 
 exit:
-	if (detail != NULL)
-		free(detail);
+	free(detail);
 	if (list != INVALID_HANDLE_VALUE)
 		SetupDiDestroyDeviceInfoList(list);