r6040: disable pci device if the subsequent calls (after pci_enable_device) fails
the calls after the pci_enable_device may fail, and will error out with out disabling it. disable the device at error paths. Signed-off-by: Devendra Naga <devendra.aaru@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
617c8c1123
commit
acaf827682
1 changed files with 6 additions and 4 deletions
|
@ -1096,20 +1096,20 @@ static int __devinit r6040_init_one(struct pci_dev *pdev,
|
||||||
if (err) {
|
if (err) {
|
||||||
dev_err(&pdev->dev, "32-bit PCI DMA addresses"
|
dev_err(&pdev->dev, "32-bit PCI DMA addresses"
|
||||||
"not supported by the card\n");
|
"not supported by the card\n");
|
||||||
goto err_out;
|
goto err_out_disable_dev;
|
||||||
}
|
}
|
||||||
err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
|
err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
|
||||||
if (err) {
|
if (err) {
|
||||||
dev_err(&pdev->dev, "32-bit PCI DMA addresses"
|
dev_err(&pdev->dev, "32-bit PCI DMA addresses"
|
||||||
"not supported by the card\n");
|
"not supported by the card\n");
|
||||||
goto err_out;
|
goto err_out_disable_dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* IO Size check */
|
/* IO Size check */
|
||||||
if (pci_resource_len(pdev, bar) < io_size) {
|
if (pci_resource_len(pdev, bar) < io_size) {
|
||||||
dev_err(&pdev->dev, "Insufficient PCI resources, aborting\n");
|
dev_err(&pdev->dev, "Insufficient PCI resources, aborting\n");
|
||||||
err = -EIO;
|
err = -EIO;
|
||||||
goto err_out;
|
goto err_out_disable_dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
pci_set_master(pdev);
|
pci_set_master(pdev);
|
||||||
|
@ -1117,7 +1117,7 @@ static int __devinit r6040_init_one(struct pci_dev *pdev,
|
||||||
dev = alloc_etherdev(sizeof(struct r6040_private));
|
dev = alloc_etherdev(sizeof(struct r6040_private));
|
||||||
if (!dev) {
|
if (!dev) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto err_out;
|
goto err_out_disable_dev;
|
||||||
}
|
}
|
||||||
SET_NETDEV_DEV(dev, &pdev->dev);
|
SET_NETDEV_DEV(dev, &pdev->dev);
|
||||||
lp = netdev_priv(dev);
|
lp = netdev_priv(dev);
|
||||||
|
@ -1238,6 +1238,8 @@ static int __devinit r6040_init_one(struct pci_dev *pdev,
|
||||||
pci_release_regions(pdev);
|
pci_release_regions(pdev);
|
||||||
err_out_free_dev:
|
err_out_free_dev:
|
||||||
free_netdev(dev);
|
free_netdev(dev);
|
||||||
|
err_out_disable_dev:
|
||||||
|
pci_disable_device(pdev);
|
||||||
err_out:
|
err_out:
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue