[v3,9/9] net/bnxt: fix coverity warnings
Checks
Commit Message
From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
return value stored in "ret" but it has been overwritten before use.
CID 353621: Code maintainability issues (UNUSED_VALUE)
Fixes: 7fe5668d2ea3 ("net/bnxt: support VLAN filter and strip")
Fixes: df6cd7c1f73a ("net/bnxt: handle reset notify async event from FW")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
drivers/net/bnxt/bnxt_ethdev.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
Comments
On 1/28/2020 9:01 PM, Ajit Khaparde wrote:
> From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
>
> return value stored in "ret" but it has been overwritten before use.
>
> CID 353621: Code maintainability issues (UNUSED_VALUE)
> Fixes: 7fe5668d2ea3 ("net/bnxt: support VLAN filter and strip")
> Fixes: df6cd7c1f73a ("net/bnxt: handle reset notify async event from FW")
> Cc: stable@dpdk.org
>
> Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
> Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Hi Kalesh,
The patch title doesn't really say much, it should say the actual reason not
just fixing a tools warning, I am updating it as:
"net/bnxt: fix return value check"
Also the defined syntax for Coverity issues is:
Coverity issue: ####
For this case it should be:
Coverity issue: 353621
@@ -1956,9 +1956,15 @@ bnxt_config_vlan_hw_stripping(struct bnxt *bp, uint64_t rx_offloads)
if (bp->eth_dev->data->dev_conf.rxmode.offloads &
DEV_RX_OFFLOAD_VLAN_FILTER) {
rc = bnxt_add_vlan_filter(bp, 0);
- bnxt_restore_vlan_filters(bp);
+ if (rc)
+ return rc;
+ rc = bnxt_restore_vlan_filters(bp);
+ if (rc)
+ return rc;
} else {
rc = bnxt_add_mac_filter(bp, vnic, NULL, 0, 0);
+ if (rc)
+ return rc;
}
rc = bnxt_hwrm_cfa_l2_set_rx_mask(bp, vnic, 0, NULL);
@@ -3961,10 +3967,16 @@ static int bnxt_restore_filters(struct bnxt *bp)
struct rte_eth_dev *dev = bp->eth_dev;
int ret = 0;
- if (dev->data->all_multicast)
+ if (dev->data->all_multicast) {
ret = bnxt_allmulticast_enable_op(dev);
- if (dev->data->promiscuous)
+ if (ret)
+ return ret;
+ }
+ if (dev->data->promiscuous) {
ret = bnxt_promiscuous_enable_op(dev);
+ if (ret)
+ return ret;
+ }
ret = bnxt_restore_mac_filters(bp);
if (ret)