net: bnxt: Fix a uninitialized variable warning.
authorzhong jiang <zhongjiang@huawei.com>
Tue, 18 Sep 2018 07:15:44 +0000 (15:15 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 19 Sep 2018 03:04:40 +0000 (20:04 -0700)
Fix the following compile warning:

drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c:49:5: warning: \91nvm_param.dir_type\92 may be used uninitialized in this function [-Wmaybe-uninitialized]
  if (nvm_param.dir_type == BNXT_NVM_PORT_CFG)

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Acked-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c

index f3b9fbcc705bc62304a5a09cbe54eae3d2e0b95d..790c684f08abcab21980cd9a8479f27cf516d464 100644 (file)
@@ -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 -EOPNOTSUPP;
+
        if (nvm_param.dir_type == BNXT_NVM_PORT_CFG)
                idx = bp->pf.port_id;
        else if (nvm_param.dir_type == BNXT_NVM_FUNC_CFG)