Commit 96a054eb authored by François Romieu's avatar François Romieu Committed by Linus Torvalds

[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: default avatarFrancois Romieu <romieu@fr.zoreil.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 58abf9b1
...@@ -1076,14 +1076,20 @@ static int __devinit vortex_init_one (struct pci_dev *pdev, ...@@ -1076,14 +1076,20 @@ static int __devinit vortex_init_one (struct pci_dev *pdev,
int rc; int rc;
/* wake up and enable device */ /* wake up and enable device */
if (pci_enable_device (pdev)) { rc = pci_enable_device (pdev);
rc = -EIO; if (rc < 0)
} else { goto out;
rc = vortex_probe1 (&pdev->dev, pci_resource_start (pdev, 0),
pdev->irq, ent->driver_data, vortex_cards_found); rc = vortex_probe1 (&pdev->dev, pci_resource_start (pdev, 0),
if (rc == 0) pdev->irq, ent->driver_data, vortex_cards_found);
vortex_cards_found++; if (rc < 0) {
pci_disable_device (pdev);
goto out;
} }
vortex_cards_found++;
out:
return rc; return rc;
} }
...@@ -3171,6 +3177,7 @@ static void __devexit vortex_remove_one (struct pci_dev *pdev) ...@@ -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 */ pci_set_power_state(VORTEX_PCI(vp), PCI_D0); /* Go active */
if (vp->pm_state_valid) if (vp->pm_state_valid)
pci_restore_state(VORTEX_PCI(vp)); pci_restore_state(VORTEX_PCI(vp));
pci_disable_device(VORTEX_PCI(vp));
} }
/* Should really use issue_and_wait() here */ /* Should really use issue_and_wait() here */
outw(TotalReset | ((vp->drv_flags & EEPROM_RESET) ? 0x04 : 0x14), outw(TotalReset | ((vp->drv_flags & EEPROM_RESET) ? 0x04 : 0x14),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment