Commit 69adcb98 authored by Zheyu Ma's avatar Zheyu Ma Committed by Jakub Kicinski

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: default avatarZheyu Ma <zheyuma97@gmail.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/1646546192-32737-1-git-send-email-zheyuma97@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 13d04d79
...@@ -3349,6 +3349,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -3349,6 +3349,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
} }
if (!adapter->registered_device_map) { if (!adapter->registered_device_map) {
dev_err(&pdev->dev, "could not register any net devices\n"); dev_err(&pdev->dev, "could not register any net devices\n");
err = -ENODEV;
goto out_free_dev; goto out_free_dev;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment