Commit a5efd873 authored by Andrew Morton's avatar Andrew Morton Committed by Jeff Garzik

[PATCH] aha152X oops fixes

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(-)
parent e58973b6
......@@ -941,7 +941,8 @@ static irqreturn_t swintr(int irqno, void *dev_id, struct pt_regs *regs)
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(struct aha152x_setup *setup)
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(struct aha152x_setup *setup)
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(struct aha152x_setup *setup)
"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:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment