Remove redundant NULL pointer checks before free functions
found by nullfree.cocci

Signed-off-by: Stephen Hemminger <step...@networkplumber.org>
Reviewed-by: Liron Himi <lir...@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 --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;
 }
-- 
2.30.2

Reply via email to