* [PATCH V2 1/2] r6040: disable pci device if the subsequent calls (after pci_enable_device) fails
@ 2012-05-29 23:38 Devendra Naga
2012-05-30 2:31 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Devendra Naga @ 2012-05-29 23:38 UTC (permalink / raw)
To: David Miller, Florian Fainelli, netdev, linux-kernel; +Cc: Devendra Naga
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>
---
drivers/net/ethernet/rdc/r6040.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/rdc/r6040.c b/drivers/net/ethernet/rdc/r6040.c
index 4de7364..f5e6f1f 100644
--- a/drivers/net/ethernet/rdc/r6040.c
+++ b/drivers/net/ethernet/rdc/r6040.c
@@ -1096,20 +1096,20 @@ static int __devinit r6040_init_one(struct pci_dev *pdev,
if (err) {
dev_err(&pdev->dev, "32-bit PCI DMA addresses"
"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));
if (err) {
dev_err(&pdev->dev, "32-bit PCI DMA addresses"
"not supported by the card\n");
- goto err_out;
+ goto err_out_disable_dev;
}
/* IO Size check */
if (pci_resource_len(pdev, bar) < io_size) {
dev_err(&pdev->dev, "Insufficient PCI resources, aborting\n");
err = -EIO;
- goto err_out;
+ goto err_out_disable_dev;
}
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));
if (!dev) {
err = -ENOMEM;
- goto err_out;
+ goto err_out_disable_dev;
}
SET_NETDEV_DEV(dev, &pdev->dev);
lp = netdev_priv(dev);
@@ -1238,6 +1238,8 @@ err_out_free_res:
pci_release_regions(pdev);
err_out_free_dev:
free_netdev(dev);
+err_out_disable_dev:
+ pci_disable_device(pdev);
err_out:
return err;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH V2 1/2] r6040: disable pci device if the subsequent calls (after pci_enable_device) fails
2012-05-29 23:38 [PATCH V2 1/2] r6040: disable pci device if the subsequent calls (after pci_enable_device) fails Devendra Naga
@ 2012-05-30 2:31 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-05-30 2:31 UTC (permalink / raw)
To: devendra.aaru; +Cc: florian, netdev, linux-kernel
From: Devendra Naga <devendra.aaru@gmail.com>
Date: Wed, 30 May 2012 05:08:42 +0530
> 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>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-05-30 2:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-29 23:38 [PATCH V2 1/2] r6040: disable pci device if the subsequent calls (after pci_enable_device) fails Devendra Naga
2012-05-30 2:31 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).