ntnic: remove unnecessary null free check

Message ID 20241023054738.528445-1-stephen@networkplumber.org (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series ntnic: remove unnecessary null free check |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/github-robot: build success github build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-marvell-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-unit-amd64-testing pending Testing pending
ci/iol-unit-arm64-testing fail Testing issues
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS

Commit Message

Stephen Hemminger Oct. 23, 2024, 5:47 a.m. UTC
No need for a if() check before calling free() since NULL is
allowed. Found by nullfree.cocci.

Fixes: 1d3f62a0c4f1 ("net/ntnic: add base init and deinit of flow API")
Cc: okl-plv@napatech.com
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/ntnic/nthw/flow_api/flow_api.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
  

Patch

diff --git a/drivers/net/ntnic/nthw/flow_api/flow_api.c b/drivers/net/ntnic/nthw/flow_api/flow_api.c
index 34e84559eb..ea3ef65ecb 100644
--- a/drivers/net/ntnic/nthw/flow_api/flow_api.c
+++ b/drivers/net/ntnic/nthw/flow_api/flow_api.c
@@ -205,8 +205,7 @@  static void done_resource_elements(struct flow_nic_dev *ndev, enum res_type_e re
 {
 	assert(ndev);
 
-	if (ndev->res[res_type].alloc_bm)
-		free(ndev->res[res_type].alloc_bm);
+	free(ndev->res[res_type].alloc_bm);
 }
 
 static void list_insert_flow_nic(struct flow_nic_dev *ndev)