common/cnxk: return on fail to init ROC Model

Message ID 20220610081415.3855297-1-hpothula@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series common/cnxk: return on fail to init ROC Model |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-abi-testing success Testing PASS

Commit Message

Hanumanth Pothula June 10, 2022, 8:14 a.m. UTC
  Return with error on fail to initialize RoC Model.

Signed-off-by: Hanumanth Pothula <hpothula@marvell.com>
---
 drivers/common/cnxk/roc_platform.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
  

Comments

Jerin Jacob June 15, 2022, 5:59 p.m. UTC | #1
On Fri, Jun 10, 2022 at 1:44 PM Hanumanth Pothula <hpothula@marvell.com> wrote:
>
> Return with error on fail to initialize RoC Model.
>
> Signed-off-by: Hanumanth Pothula <hpothula@marvell.com>


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")
    Cc: stable@dpdk.org

    Signed-off-by: Hanumanth Pothula <hpothula@marvell.com>


> ---
>  drivers/common/cnxk/roc_platform.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/common/cnxk/roc_platform.c b/drivers/common/cnxk/roc_platform.c
> index ebb6225f4d..443aa8d396 100644
> --- a/drivers/common/cnxk/roc_platform.c
> +++ b/drivers/common/cnxk/roc_platform.c
> @@ -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
>
  

Patch

diff --git a/drivers/common/cnxk/roc_platform.c b/drivers/common/cnxk/roc_platform.c
index ebb6225f4d..443aa8d396 100644
--- a/drivers/common/cnxk/roc_platform.c
+++ b/drivers/common/cnxk/roc_platform.c
@@ -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) {