linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: schmurtz@netcourrier.com
Cc: torvalds@osdl.org, linux-kernel@vger.kernel.org,
	James Bottomley <James.Bottomley@steeleye.com>
Subject: Re: Linux 2.5.75 - still can't load aha152x (isapnp) => OOPS
Date: Fri, 11 Jul 2003 10:53:58 -0700	[thread overview]
Message-ID: <20030711105358.00b125f0.akpm@osdl.org> (raw)
In-Reply-To: <wazza.87y8z5xre4.fsf@message.id>

schmurtz@netcourrier.com wrote:
>
> I'm still getting oops when loading aha152x..

Does this fix it?

(This patch is also in the linux-scsi tree.  James, is a merge planned
soon?)




From: Martin Diehl <lists@mdiehl.de>

Seems there are two problems:

* interrupt handler expects to find the host in aha152x_host[] array which
  is currently set too late after probing irq's

* despite testing for NULL swintr derefences a shpnt==NULL anyway, looks 
  like a victim of HOSTNO obfuscation ;-)

The patch below fixes the issue for me - succesfully tested to compile, 
load and even use my attached scanner.



 drivers/scsi/aha152x.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff -puN drivers/scsi/aha152x.c~aha152x-oops-fix drivers/scsi/aha152x.c
--- 25/drivers/scsi/aha152x.c~aha152x-oops-fix	2003-06-26 18:38:55.000000000 -0700
+++ 25-akpm/drivers/scsi/aha152x.c	2003-06-26 18:38:55.000000000 -0700
@@ -941,7 +941,8 @@ static irqreturn_t swintr(int irqno, voi
 	struct Scsi_Host *shpnt = lookup_irq(irqno);
 
 	if (!shpnt) {
-        	printk(KERN_ERR "aha152x%d: catched software interrupt %d for unknown controller.\n", HOSTNO, irqno);
+		/* no point using HOSTNO here! */
+        	printk(KERN_ERR "aha152x: catched software interrupt %d for unknown controller.\n", irqno);
 		return IRQ_NONE;
 	}
 
@@ -1049,6 +1050,10 @@ struct Scsi_Host *aha152x_probe_one(stru
 
 	printk(KERN_INFO "aha152x%d: trying software interrupt, ",
 			 shost->host_no);
+
+	/* need to have host registered before triggering any interrupt */
+	aha152x_host[registered_count] = shost;
+	mb();
 	SETPORT(DMACNTRL0, SWINT|INTEN);
 	mdelay(1000);
 	free_irq(shost->irq, shost);
@@ -1064,7 +1069,7 @@ struct Scsi_Host *aha152x_probe_one(stru
 
 		printk(KERN_ERR "aha152x%d: IRQ %d possibly wrong.  "
 				"Please verify.\n", shost->host_no, shost->irq);
-		goto out_release_region;
+		goto out_unregister_host;
 	}
 	printk("ok.\n");
 
@@ -1077,12 +1082,12 @@ struct Scsi_Host *aha152x_probe_one(stru
 				"aha152x", shost) < 0) {
 		printk(KERN_ERR "aha152x%d: failed to reassign interrupt.\n",
 				shost->host_no);
-		goto out_release_region;
+		goto out_unregister_host;
 	}
-
-	aha152x_host[registered_count] = shost;
 	return shost;	/* the pcmcia stub needs the return value; */
 
+out_unregister_host:
+	aha152x_host[registered_count] = NULL;
 out_release_region:
 	release_region(shost->io_port, IO_RANGE);
 out_unregister:

_


  reply	other threads:[~2003-07-11 17:46 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-10 21:14 Linux 2.5.75 Linus Torvalds
2003-07-10 21:35 ` Russell King
2003-07-10 22:26   ` Linus Torvalds
2003-07-10 23:05     ` Russell King
2003-07-10 23:25       ` Linus Torvalds
2003-07-11 19:59       ` Horst von Brand
2003-07-10 23:30 ` Felipe Alfaro Solana
2003-07-10 23:38   ` Linus Torvalds
2003-07-10 23:46     ` Davide Libenzi
2003-07-10 23:40   ` Robert Love
2003-07-11  0:24     ` Diego Calleja García
2003-07-11  0:49       ` Wade
2003-07-11  7:09 ` Benjamin Herrenschmidt
2003-07-11 10:57 ` Linux 2.5.75 - still can't load aha152x (isapnp) => OOPS schmurtz
2003-07-11 17:53   ` Andrew Morton [this message]
2003-07-11 18:04     ` James Bottomley
2003-07-11 18:45     ` schmurtz
2003-07-11 12:30 ` incbin (was: Re: Linux 2.5.75) Geert Uytterhoeven
2003-07-11 12:32   ` Geert Uytterhoeven
2003-07-11 15:46 ` Linux 2.5.75 Oliver Pitzeier
2003-07-11 15:52 ` Linux 2.5.75 (compile statistics) John Cherry
2003-07-12 13:50 ` AMD 53C974 based SCSI adapter (was: Linux 2.5.75) Matthias Andree

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=20030711105358.00b125f0.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=James.Bottomley@steeleye.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=schmurtz@netcourrier.com \
    --cc=torvalds@osdl.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 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).