Skip to content

Commit

Permalink
net: chelsio: cxgb3: check the return value of pci_find_capability()
Browse files Browse the repository at this point in the history
The function pci_find_capability() in t3_prep_adapter() can fail, so its
return value should be checked.

Fixes: 4d22de3 ("Add support for the latest 1G/10G Chelsio adapter, T3")
Reported-by: TOTE Robot <[email protected]>
Signed-off-by: Jia-Ju Bai <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
XidianGeneral authored and davem330 committed Feb 25, 2022
1 parent 5a83dd1 commit 767b982
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/net/ethernet/chelsio/cxgb3/t3_hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -3613,6 +3613,8 @@ int t3_prep_adapter(struct adapter *adapter, const struct adapter_info *ai,
MAC_STATS_ACCUM_SECS : (MAC_STATS_ACCUM_SECS * 10);
adapter->params.pci.vpd_cap_addr =
pci_find_capability(adapter->pdev, PCI_CAP_ID_VPD);
if (!adapter->params.pci.vpd_cap_addr)
return -ENODEV;
ret = get_vpd_params(adapter, &adapter->params.vpd);
if (ret < 0)
return ret;
Expand Down

0 comments on commit 767b982

Please sign in to comment.