Skip to contentSkip to conversation

common/cnxk: return on fail to init ROC Model

PATCH In review Hanumanth Pothula 2 participants 2 messages Jun 10, 2022 – Jun 15, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common/cnxk: return on fail to init ROC Model

Return with error on fail to initialize RoC Model.

---
 drivers/common/cnxk/roc_platform.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/common/cnxk/roc_platform.c +6 -1
index ebb6225f4d..443aa8d396 100644
@@ -37,7 +37,12 @@ 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) {
Signature · 1 line
2.25.1
#1 lore raw
Quoted 4 lines · Hanumanth Pothula

Return with error on fail to initialize RoC Model.

Updated the git commit as follows and applied to
dpdk-next-net-mrvl/for-next-net. Thanks

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")
Quoted 25 lines
---
 drivers/common/cnxk/roc_platform.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/common/cnxk/roc_platform.c +6 -2
index ebb6225f4d..443aa8d396 100644
@@ -37,7 +37,12 @@ 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) {
--

2.25.1