Skip to contentSkip to conversation

3c59x: missing pci_disable_device

PATCH In review Francois Romieu 3 participants 4 messages Sep 18, 2004 – Sep 20, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

drivers/net/3c59x.c renamed from drivers/net/3c59x.c~3c59x-00 +14 -7
diff -puN drivers/net/3c59x.c~3c59x-00 drivers/net/3c59x.c
@@ -1075,14 +1075,20 @@ static int __devinit vortex_init_one (st
 	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;
 }
 
@@ -3163,6 +3169,7 @@ static void __devexit vortex_remove_one 
 		pci_set_power_state(VORTEX_PCI(vp), 0);	/* Go active */
 		if (vp->pm_state_valid)
 			pci_restore_state(VORTEX_PCI(vp), vp->power_state);
+		pci_disable_device(VORTEX_PCI(vp));
 	}
 	/* Should really use issue_and_wait() here */
 	outw(TotalReset|0x14, dev->base_addr + EL3_CMD);

_

#1 lore raw

Andrew,

Are you picking up this 3c59x patch, or should I stick it into netdev-2.6?

Jeff

#2 lore raw
Quoted 2 lines · Jeff Garzik

Are you picking up this 3c59x patch,

I did so.

Quoted 1 line

or should I stick it into netdev-2.6?

That works, too.

#3 lore raw
Quoted 6 lines · Andrew Morton
Quoted 1 line · Jeff Garzik

Are you picking up this 3c59x patch,

I did so.

Since I am always eager to hand off 3c59x patches, I'll leave it out of netdev-2.6 then... :)

Jeff