* [PATCH v2] net: bnxt: Fix a uninitialized variable warning.
@ 2018-09-18 4:55 zhong jiang
2018-09-18 7:02 ` Michael Chan
0 siblings, 1 reply; 3+ messages in thread
From: zhong jiang @ 2018-09-18 4:55 UTC (permalink / raw)
To: michael.chan, davem, vasundhara-v.volam; +Cc: netdev, linux-kernel
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@huawei.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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] net: bnxt: Fix a uninitialized variable warning.
2018-09-18 4:55 [PATCH v2] net: bnxt: Fix a uninitialized variable warning zhong jiang
@ 2018-09-18 7:02 ` Michael Chan
2018-09-18 7:18 ` zhong jiang
0 siblings, 1 reply; 3+ messages in thread
From: Michael Chan @ 2018-09-18 7:02 UTC (permalink / raw)
To: zhong jiang; +Cc: David Miller, Vasundhara Volam, Netdev, open list
On Mon, Sep 17, 2018 at 9:55 PM, zhong jiang <zhongjiang@huawei.com> wrote:
> 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@huawei.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;
> +
-EOPNOTSUPP might be a better return code. Other than that, it looks
good to me. Thanks.
> 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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] net: bnxt: Fix a uninitialized variable warning.
2018-09-18 7:02 ` Michael Chan
@ 2018-09-18 7:18 ` zhong jiang
0 siblings, 0 replies; 3+ messages in thread
From: zhong jiang @ 2018-09-18 7:18 UTC (permalink / raw)
To: Michael Chan; +Cc: David Miller, Vasundhara Volam, Netdev, open list
On 2018/9/18 15:02, Michael Chan wrote:
> On Mon, Sep 17, 2018 at 9:55 PM, zhong jiang <zhongjiang@huawei.com> wrote:
>> 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@huawei.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;
>> +
> -EOPNOTSUPP might be a better return code. Other than that, it looks
> good to me. Thanks.
Thanks for suggestion. Will repost.
Sincerely,
zhong jiang
>> 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
>>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-09-18 7:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-18 4:55 [PATCH v2] net: bnxt: Fix a uninitialized variable warning zhong jiang
2018-09-18 7:02 ` Michael Chan
2018-09-18 7:18 ` zhong jiang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).