From 729ff70320ebe1a8750e0a330cd5eded27fb8a34 Mon Sep 17 00:00:00 2001 From: Ajit Khaparde Date: Mon, 8 Jan 2018 12:24:25 -0800 Subject: [PATCH] net/bnxt: check return values in init We are not checking for return values of functions like bnxt_hwrm_queue_qportcfg and bnxt_hwrm_func_qcfg in bnxt_dev_init thereby preventing a cleanup in case of a HWRM command failure. This patch fixes that. Signed-off-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_ethdev.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 6f8a6335b3..29f494302c 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -3172,9 +3172,17 @@ skip_init: rc = bnxt_hwrm_ver_get(bp); if (rc) goto error_free; - bnxt_hwrm_queue_qportcfg(bp); + rc = bnxt_hwrm_queue_qportcfg(bp); + if (rc) { + RTE_LOG(ERR, PMD, "hwrm queue qportcfg failed\n"); + goto error_free; + } - bnxt_hwrm_func_qcfg(bp); + rc = bnxt_hwrm_func_qcfg(bp); + if (rc) { + RTE_LOG(ERR, PMD, "hwrm func qcfg failed\n"); + goto error_free; + } /* Get the MAX capabilities for this function */ rc = bnxt_hwrm_func_qcaps(bp); -- 2.20.1