diff mbox series

[v2,73/83] regex/cn9k: remove unnecessary NULL checks

Message ID 20220124174719.14417-74-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:47 p.m. UTC
Remove redundant NULL pointer checks before free functions
found by nullfree.cocci

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Liron Himi <lironh@marvell.com>
---
 drivers/regex/cn9k/cn9k_regexdev.c          | 6 ++----
 drivers/regex/cn9k/cn9k_regexdev_compiler.c | 3 +--
 2 files changed, 3 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/drivers/regex/cn9k/cn9k_regexdev.c b/drivers/regex/cn9k/cn9k_regexdev.c
index 32d20c1be82b..56c862c5a76c 100644
--- a/drivers/regex/cn9k/cn9k_regexdev.c
+++ b/drivers/regex/cn9k/cn9k_regexdev.c
@@ -256,10 +256,8 @@  ree_dev_fini(struct rte_regexdev *dev)
 		cn9k_err("Could not detach queues");
 
 	/* TEMP : should be in lib */
-	if (data->queue_pairs)
-		rte_free(data->queue_pairs);
-	if (data->rules)
-		rte_free(data->rules);
+	rte_free(data->queue_pairs);
+	rte_free(data->rules);
 
 	roc_ree_dev_fini(vf);
 
diff --git a/drivers/regex/cn9k/cn9k_regexdev_compiler.c b/drivers/regex/cn9k/cn9k_regexdev_compiler.c
index 935b8a53b459..60f1c1b4c4d8 100644
--- a/drivers/regex/cn9k/cn9k_regexdev_compiler.c
+++ b/drivers/regex/cn9k/cn9k_regexdev_compiler.c
@@ -214,8 +214,7 @@  cn9k_ree_rule_db_compile_prog(struct rte_regexdev *dev)
 	rxp_free_structs(NULL, NULL, NULL, NULL, NULL, &rof, NULL, &rofi, NULL,
 			1);
 
-	if (rule_db)
-		rte_free(rule_db);
+	rte_free(rule_db);
 
 	return ret;
 }