netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Francois Romieu <romieu@fr.zoreil.com>
To: akpm@osdl.org
Cc: jgarzik@pobom.com, netdev@oss.sgi.com
Subject: [PATCH 2.6.9-rc2-mm1 1/1] 3c59x: missing pci_disable_device
Date: Sun, 19 Sep 2004 00:01:22 +0200	[thread overview]
Message-ID: <20040918220122.GA15528@electric-eye.fr.zoreil.com> (raw)

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>

diff -puN drivers/net/3c59x.c~3c59x-00 drivers/net/3c59x.c
--- linux-2.6.9-rc2/drivers/net/3c59x.c~3c59x-00	2004-09-18 22:20:43.000000000 +0200
+++ linux-2.6.9-rc2-fr/drivers/net/3c59x.c	2004-09-18 22:20:43.000000000 +0200
@@ -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);

_

             reply	other threads:[~2004-09-18 22:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-18 22:01 Francois Romieu [this message]
2004-09-20 18:16 ` [PATCH 2.6.9-rc2-mm1 1/1] 3c59x: missing pci_disable_device Jeff Garzik
2004-09-20 18:35   ` Andrew Morton
2004-09-20 18:39     ` Jeff Garzik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040918220122.GA15528@electric-eye.fr.zoreil.com \
    --to=romieu@fr.zoreil.com \
    --cc=akpm@osdl.org \
    --cc=jgarzik@pobom.com \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).