Skip to content

Commit

Permalink
net: cxgb3: Fix an error code when probing the driver
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Andrew Lunn <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
ZheyuMa authored and kuba-moo committed Mar 8, 2022
1 parent 13d04d7 commit 69adcb9
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 69adcb9

Please sign in to comment.