net/bnxt: check return values in init
authorAjit Khaparde <ajit.khaparde@broadcom.com>
Mon, 8 Jan 2018 20:24:25 +0000 (12:24 -0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 16 Jan 2018 17:47:49 +0000 (18:47 +0100)
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 <ajit.khaparde@broadcom.com>
drivers/net/bnxt/bnxt_ethdev.c

index 6f8a633..29f4943 100644 (file)
@@ -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);