linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: chelsio: cxgb4vf: Fix an error code in cxgb4vf_pci_probe()
@ 2021-11-23  2:21 Zheyu Ma
  2021-11-23 12:20 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Zheyu Ma @ 2021-11-23  2:21 UTC (permalink / raw)
  To: rajur, davem, kuba; +Cc: netdev, linux-kernel, Zheyu Ma

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.

Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
---
 drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
index 64479c464b4e..ae9cca768d74 100644
--- a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c
@@ -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;
 	}
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: chelsio: cxgb4vf: Fix an error code in cxgb4vf_pci_probe()
  2021-11-23  2:21 [PATCH] net: chelsio: cxgb4vf: Fix an error code in cxgb4vf_pci_probe() Zheyu Ma
@ 2021-11-23 12:20 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-11-23 12:20 UTC (permalink / raw)
  To: Zheyu Ma; +Cc: rajur, davem, kuba, netdev, linux-kernel

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-23 12:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-23  2:21 [PATCH] net: chelsio: cxgb4vf: Fix an error code in cxgb4vf_pci_probe() Zheyu Ma
2021-11-23 12:20 ` patchwork-bot+netdevbpf

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).