aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorFrançois Romieu <romieu@fr.zoreil.com>2005-01-10 17:17:01 -0800
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-01-10 17:17:01 -0800
commit96a054eb332a6c561b5d989d5827a3007a60f4b2 (patch)
tree159e5f681f22688619aa5160ae0e37cab9c2898c /drivers
parent58abf9b1d26a55163b5bff01b4ca7320a8472bab (diff)
downloadhistory-96a054eb332a6c561b5d989d5827a3007a60f4b2.tar.gz
[PATCH] 3c59x: missing pci_disable_device
It is possible to remove the device without calling pci_disable_device(). A leak can take place during the init as well. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/3c59x.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c
index 64e3fe0375c39a..a10eb3b9506925 100644
--- a/drivers/net/3c59x.c
+++ b/drivers/net/3c59x.c
@@ -1076,14 +1076,20 @@ static int __devinit vortex_init_one (struct pci_dev *pdev,
int rc;
/* wake up and enable device */
- if (pci_enable_device (pdev)) {
- rc = -EIO;
- } else {
- rc = vortex_probe1 (&pdev->dev, pci_resource_start (pdev, 0),
- pdev->irq, ent->driver_data, vortex_cards_found);
- if (rc == 0)
- vortex_cards_found++;
+ rc = pci_enable_device (pdev);
+ if (rc < 0)
+ goto out;
+
+ rc = vortex_probe1 (&pdev->dev, pci_resource_start (pdev, 0),
+ pdev->irq, ent->driver_data, vortex_cards_found);
+ if (rc < 0) {
+ pci_disable_device (pdev);
+ goto out;
}
+
+ vortex_cards_found++;
+
+out:
return rc;
}
@@ -3171,6 +3177,7 @@ static void __devexit vortex_remove_one (struct pci_dev *pdev)
pci_set_power_state(VORTEX_PCI(vp), PCI_D0); /* Go active */
if (vp->pm_state_valid)
pci_restore_state(VORTEX_PCI(vp));
+ pci_disable_device(VORTEX_PCI(vp));
}
/* Should really use issue_and_wait() here */
outw(TotalReset | ((vp->drv_flags & EEPROM_RESET) ? 0x04 : 0x14),