From 5f27618bea73240ac4e71e9ed9bb14b25c95505d Mon Sep 17 00:00:00 2001 From: Hanumanth Pothula Date: Fri, 10 Jun 2022 13:44:14 +0530 Subject: [PATCH] common/cnxk: handle ROC model init failure Return with error on fail to initialize ROC model. Fixes: 014a9e222bac ("common/cnxk: add model init and IO handling API") Cc: stable@dpdk.org Signed-off-by: Hanumanth Pothula --- drivers/common/cnxk/roc_platform.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/common/cnxk/roc_platform.c b/drivers/common/cnxk/roc_platform.c index ebb6225f4d..ce0f9b870c 100644 --- a/drivers/common/cnxk/roc_platform.c +++ b/drivers/common/cnxk/roc_platform.c @@ -37,7 +37,11 @@ roc_plt_init(void) plt_err("Failed to reserve mem for roc_model"); return -ENOMEM; } - roc_model_init(mz->addr); + if (roc_model_init(mz->addr)) { + plt_err("Failed to init roc_model"); + rte_memzone_free(mz); + return -EINVAL; + } } } else { if (mz == NULL) {