diff options
author | Zheyu Ma <zheyuma97@gmail.com> | 2022-03-06 05:56:32 +0000 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2022-03-07 22:18:52 -0800 |
commit | 69adcb988a0675ce001dfc416d56fba2e8a85f48 (patch) | |
tree | 811afe1fa516699ac96736695846336e2659bf9e /drivers | |
parent | 13d04d79701ba240969b296903de14db3734ab25 (diff) | |
download | linux-69adcb988a0675ce001dfc416d56fba2e8a85f48.tar.bz2 |
net: cxgb3: Fix an error code when probing the driver
During the process of driver probing, probe function should return < 0
for failure, otherwise kernel will treat value >= 0 as success.
Therefore, the driver should set 'err' to -ENODEV when
'adapter->registered_device_map' is NULL. Otherwise kernel will assume
that the driver has been successfully probed and will cause unexpected
errors.
Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/1646546192-32737-1-git-send-email-zheyuma97@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c index 63521312cb90..174b1e156669 100644 --- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c +++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c @@ -3349,6 +3349,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) } if (!adapter->registered_device_map) { dev_err(&pdev->dev, "could not register any net devices\n"); + err = -ENODEV; goto out_free_dev; } |