Skip to contentSkip to conversation

net: chelsio: cxgb3: check the return value of pci_find_capability()

PATCH Applied Jia-Ju Bai 2 participants 2 messages Feb 25, 2022

Subsystems (3)
lore
Share & tools
lore

Jia-Ju Bai

author
#0 lore raw

PATCH 1/1 net: chelsio: cxgb3: check the return value of pci_find_capability()

The function pci_find_capability() in t3_prep_adapter() can fail, so its return value should be checked.

Fixes 4d22de3e6cc4 ("Add support for the latest 1G/10G Chelsio adapter, T3")
---
 drivers/net/ethernet/chelsio/cxgb3/t3_hw.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/chelsio/cxgb3/t3_hw.c +2 -0
index da41eee2f25c..a06003bfa04b 100644
@@ -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;
Signature · 1 line
2.17.1
#1 lore raw
This patch was applied to netdev/net.git (master) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <[email protected]>:

Quoted 8 lines · On Fri, 25 Feb 2022 04:37:27 -0800 you wrote:

The function pci_find_capability() in t3_prep_adapter() can fail, so its return value should be checked.

Fixes 4d22de3e6cc4 ("Add support for the latest 1G/10G Chelsio adapter, T3")

[...]

Here is the summary with links:
- net: chelsio: cxgb3: check the return value of pci_find_capability()

    https://git.kernel.org/netdev/net/c/767b9825ed17

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html