All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chuck Ebbert <cebbert@redhat.com>
To: netdev@vger.kernel.org
Subject: [proposed patch] via-rhine: prevent oops when requesting an IRQ
Date: Tue, 4 Nov 2008 19:23:57 -0500	[thread overview]
Message-ID: <20081104192357.2b0dbe22@redhat.com> (raw)

via-rhine: prevent oops when requesting an IRQ

via-rhine requests an IRQ before it's ready to handle an interrupt.
It oopses when CONFIG_DEBUG_SHIRQ is enabled.

https://bugzilla.redhat.com/show_bug.cgi?id=469303

---

NOTE: UNTESTED: Is it okay to init the hardware before requesting the
IRQ, or should that be done afterward?

Index: linux-2.6.27.noarch/drivers/net/via-rhine.c
===================================================================
--- linux-2.6.27.noarch.orig/drivers/net/via-rhine.c
+++ linux-2.6.27.noarch/drivers/net/via-rhine.c
@@ -1141,24 +1141,27 @@ static int rhine_open(struct net_device 
 	void __iomem *ioaddr = rp->base;
 	int rc;
 
-	rc = request_irq(rp->pdev->irq, &rhine_interrupt, IRQF_SHARED, dev->name,
-			dev);
+	rc = alloc_ring(dev);
 	if (rc)
 		return rc;
 
-	if (debug > 1)
-		printk(KERN_DEBUG "%s: rhine_open() irq %d.\n",
-		       dev->name, rp->pdev->irq);
-
-	rc = alloc_ring(dev);
-	if (rc) {
-		free_irq(rp->pdev->irq, dev);
-		return rc;
-	}
 	alloc_rbufs(dev);
 	alloc_tbufs(dev);
 	rhine_chip_reset(dev);
 	init_registers(dev);
+
+	rc = request_irq(rp->pdev->irq, &rhine_interrupt, IRQF_SHARED, dev->name,
+			dev);
+	if (rc) {
+		free_tbufs(dev);
+		free_rbufs(dev);
+		free_ring(dev);
+		return rc;
+	}
+
+	if (debug > 1)
+		printk(KERN_DEBUG "%s: rhine_open() irq %d.\n",
+		       dev->name, rp->pdev->irq);
 	if (debug > 2)
 		printk(KERN_DEBUG "%s: Done rhine_open(), status %4.4x "
 		       "MII status: %4.4x.\n",

             reply	other threads:[~2008-11-05  0:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-05  0:23 Chuck Ebbert [this message]
2008-11-06  6:07 ` [proposed patch] via-rhine: prevent oops when requesting an IRQ Jeff Garzik
2008-11-10 22:28   ` Chuck Ebbert
2008-11-10 22:35     ` 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=20081104192357.2b0dbe22@redhat.com \
    --to=cebbert@redhat.com \
    --cc=netdev@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.