[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1537246516-33100-1-git-send-email-zhongjiang@huawei.com>
Date: Tue, 18 Sep 2018 12:55:16 +0800
From: zhong jiang <zhongjiang@...wei.com>
To: <michael.chan@...adcom.com>, <davem@...emloft.net>,
<vasundhara-v.volam@...adcom.com>
CC: <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH v2] net: bnxt: Fix a uninitialized variable warning.
Fix the following compile warning:
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c:49:5: warning: nvm_param.dir_type may be used uninitialized in this function [-Wmaybe-uninitialized]
if (nvm_param.dir_type == BNXT_NVM_PORT_CFG)
Signed-off-by: zhong jiang <zhongjiang@...wei.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
index f3b9fbc..1ae56fc 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
@@ -46,6 +46,9 @@ static int bnxt_hwrm_nvm_req(struct bnxt *bp, u32 param_id, void *msg,
}
}
+ if (i == ARRAY_SIZE(nvm_params))
+ return -EINVAL;
+
if (nvm_param.dir_type == BNXT_NVM_PORT_CFG)
idx = bp->pf.port_id;
else if (nvm_param.dir_type == BNXT_NVM_FUNC_CFG)
--
1.7.12.4
Powered by blists - more mailing lists