[PATCH 3/3] ml/cnxk: remove unnecessary NULL check

Stephen Hemminger stephen at networkplumber.org
Tue Jul 28 16:11:45 CEST 2026


No need to check for NULL before calling rte_free.
Found by cocci/nullfree.cocci script.

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 drivers/ml/cnxk/tvmrt_ml_model.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/ml/cnxk/tvmrt_ml_model.c b/drivers/ml/cnxk/tvmrt_ml_model.c
index 319c53a05b..90bb286822 100644
--- a/drivers/ml/cnxk/tvmrt_ml_model.c
+++ b/drivers/ml/cnxk/tvmrt_ml_model.c
@@ -133,10 +133,8 @@ tvmrt_ml_model_blob_parse(struct rte_ml_model_params *params, struct tvmrt_ml_mo
 	goto cleanup;
 
 error:
-	for (i = 0; i < ML_TVMRT_MODEL_OBJECT_MAX; i++) {
-		if (object[i].buffer != NULL)
-			rte_free(object[i].buffer);
-	}
+	for (i = 0; i < ML_TVMRT_MODEL_OBJECT_MAX; i++)
+		rte_free(object[i].buffer);
 
 cleanup:
 	archive_read_close(a);
-- 
2.53.0



More information about the dev mailing list