mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@osdl.org>,
	perex@suse.cz
Subject: Re: [PATCH] hp100.c: add missing pci_enable_device()
Date: Wed, 25 Aug 2004 09:23:58 -0600	[thread overview]
Message-ID: <200408250923.58024.bjorn.helgaas@hp.com> (raw)
In-Reply-To: <412BE04F.3050306@pobox.com>

On Tuesday 24 August 2004 6:41 pm, Jeff Garzik wrote:
> Linux Kernel Mailing List wrote:
> > diff -Nru a/drivers/net/hp100.c b/drivers/net/hp100.c
> > --- a/drivers/net/hp100.c	2004-08-24 15:25:16 -07:00
> > +++ b/drivers/net/hp100.c	2004-08-24 15:25:16 -07:00
> > @@ -2910,10 +2910,15 @@
> >  	int ioaddr = pci_resource_start(pdev, 0);
> >  	u_short pci_command;
> >  	int err;
> > -	
> > +
> >  	if (!dev)
> >  		return -ENOMEM;
> >  
> > +	if (pci_enable_device(pdev)) {
> 
> 
> _Obviously_ incomplete change.  Look above, and see pci_resource_start()

Thanks.  Here's an additional patch to address this problem (again,
compiled but not tested because I don't have the hardware):


Don't look at pci_resource_start() before pci_enable_device().

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>

===== drivers/net/hp100.c 1.29 vs edited =====
--- 1.29/drivers/net/hp100.c	2004-08-24 03:08:34 -06:00
+++ edited/drivers/net/hp100.c	2004-08-25 09:12:59 -06:00
@@ -2906,16 +2906,17 @@
 static int __devinit hp100_pci_probe (struct pci_dev *pdev,
 				     const struct pci_device_id *ent)
 {
-	struct net_device *dev = alloc_etherdev(sizeof(struct hp100_private));
-	int ioaddr = pci_resource_start(pdev, 0);
+	struct net_device *dev;
+	int ioaddr;
 	u_short pci_command;
 	int err;
 
-	if (!dev)
-		return -ENOMEM;
+	if (pci_enable_device(pdev))
+		return -ENODEV;
 
-	if (pci_enable_device(pdev)) {
-		err = -ENODEV;
+	dev = alloc_etherdev(sizeof(struct hp100_private));
+	if (!dev) {
+		err = -ENOMEM;
 		goto out0;
 	}
 
@@ -2939,7 +2940,7 @@
 		pci_write_config_word(pdev, PCI_COMMAND, pci_command);
 	}
 	
-
+	ioaddr = pci_resource_start(pdev, 0);
 	err = hp100_probe1(dev, ioaddr, HP100_BUS_PCI, pdev);
 	if (err) 
 		goto out1;
@@ -2956,8 +2957,8 @@
 	release_region(dev->base_addr, HP100_REGION_SIZE);
  out1:
 	free_netdev(dev);
-	pci_disable_device(pdev);
  out0:
+	pci_disable_device(pdev);
 	return err;
 }
 

      reply	other threads:[~2004-08-25 15:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200408242225.i7OMP5ak029691@hera.kernel.org>
2004-08-25  0:41 ` Jeff Garzik
2004-08-25 15:23   ` Bjorn Helgaas [this message]

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=200408250923.58024.bjorn.helgaas@hp.com \
    --to=bjorn.helgaas@hp.com \
    --cc=akpm@osdl.org \
    --cc=jgarzik@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@suse.cz \
    /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

all inboxes | Powered by JetHome®