Skip to contentSkip to conversation

net: chelsio: cxgb4vf: Fix an error code in cxgb4vf_pci_probe()

PATCH Applied Zheyu Ma 2 participants 2 messages Nov 23, 2021

Subsystems (3)
lore
Share & tools
lore

Zheyu Ma

author
#0 lore raw

PATCH 1/1 net: chelsio: cxgb4vf: Fix an error code in cxgb4vf_pci_probe()

During the process of driver probing, probe function should return < 0 for failure, otherwise kernel will treat value == 0 as success.

Therefore, we should set err to -EINVAL when adapter->registered_device_map is NULL. Otherwise kernel will assume that driver has been successfully probed and will cause unexpected errors.

---
 drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c +1 -0
index 64479c464b4e..ae9cca768d74 100644
@@ -3196,6 +3196,7 @@ static int cxgb4vf_pci_probe(struct pci_dev *pdev,
 	}
 	if (adapter->registered_device_map == 0) {
 		dev_err(&pdev->dev, "could not register any net devices\n");
+		err = -EINVAL;
 		goto err_disable_interrupts;
 	}
 
Signature · 1 line
2.25.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 9 lines · On Tue, 23 Nov 2021 02:21:50 +0000 you wrote:

During the process of driver probing, probe function should return < 0 for failure, otherwise kernel will treat value == 0 as success.

Therefore, we should set err to -EINVAL when adapter->registered_device_map is NULL. Otherwise kernel will assume that driver has been successfully probed and will cause unexpected errors.

[...]

Here is the summary with links:
- net: chelsio: cxgb4vf: Fix an error code in cxgb4vf_pci_probe()

    https://git.kernel.org/netdev/net/c/b82d71c0f84a

You are awesome, thank you!

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