common/cnxk: handle ROC model init failure
authorHanumanth Pothula <hpothula@marvell.com>
Fri, 10 Jun 2022 08:14:14 +0000 (13:44 +0530)
committerJerin Jacob <jerinj@marvell.com>
Wed, 15 Jun 2022 17:55:42 +0000 (19:55 +0200)
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 <hpothula@marvell.com>
drivers/common/cnxk/roc_platform.c

index ebb6225..ce0f9b8 100644 (file)
@@ -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) {