gve: Propagate error codes to caller

If 'gve_probe()' fails, we should propagate the error code, instead of
hard coding a -ENXIO value.
Make sure that all error handling paths set a correct value for 'err'.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Catherine Sullivan <csully@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Christophe JAILLET 2021-07-01 22:18:37 +02:00 committed by David S. Miller
parent 2342ae10d1
commit 6dce38b4b7
1 changed files with 3 additions and 2 deletions

View File

@ -1469,7 +1469,7 @@ static int gve_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
err = pci_enable_device(pdev);
if (err)
return -ENXIO;
return err;
err = pci_request_regions(pdev, "gvnic-cfg");
if (err)
@ -1512,6 +1512,7 @@ static int gve_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
dev = alloc_etherdev_mqs(sizeof(*priv), max_tx_queues, max_rx_queues);
if (!dev) {
dev_err(&pdev->dev, "could not allocate netdev\n");
err = -ENOMEM;
goto abort_with_db_bar;
}
SET_NETDEV_DEV(dev, &pdev->dev);
@ -1593,7 +1594,7 @@ abort_with_pci_region:
abort_with_enabled:
pci_disable_device(pdev);
return -ENXIO;
return err;
}
static void gve_remove(struct pci_dev *pdev)