Commit d5be82a5 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by James Bottomley

[PATCH] fix sym53c416 check_region usage

again, the init code could use some bigger rework, but let's stick to
the minimal fix until we have some testers.
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent e2dc0bba
...@@ -622,13 +622,14 @@ void sym53c416_probe(void) ...@@ -622,13 +622,14 @@ void sym53c416_probe(void)
int ints[2]; int ints[2];
ints[0] = 1; ints[0] = 1;
for(; *base; base++) for(; *base; base++) {
{ if (request_region(*base, IO_RANGE, ID)) {
if(!check_region(*base, IO_RANGE) && sym53c416_test(*base)) if (sym53c416_test(*base)) {
{
ints[1] = *base; ints[1] = *base;
sym53c416_setup(NULL, ints); sym53c416_setup(NULL, ints);
} }
release_region(*base, IO_RANGE);
}
} }
} }
...@@ -702,33 +703,28 @@ int __init sym53c416_detect(Scsi_Host_Template *tpnt) ...@@ -702,33 +703,28 @@ int __init sym53c416_detect(Scsi_Host_Template *tpnt)
sym53c416_probe(); sym53c416_probe();
/* Now we register and set up each host adapter found... */ /* Now we register and set up each host adapter found... */
for(count = 0, i = 0; i < host_index; i++) for(count = 0, i = 0; i < host_index; i++) {
{ if (!request_region(hosts[i].base, IO_RANGE, ID))
if(!sym53c416_test(hosts[i].base)) continue;
if (!sym53c416_test(hosts[i].base)) {
printk(KERN_WARNING "No sym53c416 found at address 0x%03x\n", hosts[i].base); printk(KERN_WARNING "No sym53c416 found at address 0x%03x\n", hosts[i].base);
else goto fail_release_region;
{ }
if(hosts[i].irq == 0)
/* We don't have an irq yet, so we should probe for one */ /* We don't have an irq yet, so we should probe for one */
if((hosts[i].irq = sym53c416_probeirq(hosts[i].base, hosts[i].scsi_id)) == 0) if (!hosts[i].irq)
printk(KERN_WARNING "IRQ autoprobing failed for sym53c416 at address 0x%03x\n", hosts[i].base); hosts[i].irq = sym53c416_probeirq(hosts[i].base, hosts[i].scsi_id);
if(hosts[i].irq && !check_region(hosts[i].base, IO_RANGE)) if (!hosts[i].irq)
{ goto fail_release_region;
shpnt = scsi_register(tpnt, 0); shpnt = scsi_register(tpnt, 0);
if(shpnt==NULL) if (!shpnt)
continue; goto fail_release_region;
spin_lock_irqsave(&sym53c416_lock, flags);
/* Request for specified IRQ */ /* Request for specified IRQ */
if(request_irq(hosts[i].irq, sym53c416_intr_handle, 0, ID, shpnt)) if (request_irq(hosts[i].irq, sym53c416_intr_handle, 0, ID, shpnt))
{ goto fail_free_host;
spin_unlock_irqrestore(&sym53c416_lock, flags);
printk(KERN_ERR "sym53c416: Unable to assign IRQ %d\n", hosts[i].irq); spin_lock_irqsave(&sym53c416_lock, flags);
scsi_unregister(shpnt);
}
else
{
/* Inform the kernel of our IO range */
request_region(hosts[i].base, IO_RANGE, ID);
shpnt->unique_id = hosts[i].base; shpnt->unique_id = hosts[i].base;
shpnt->io_port = hosts[i].base; shpnt->io_port = hosts[i].base;
shpnt->n_io_port = IO_RANGE; shpnt->n_io_port = IO_RANGE;
...@@ -737,9 +733,12 @@ int __init sym53c416_detect(Scsi_Host_Template *tpnt) ...@@ -737,9 +733,12 @@ int __init sym53c416_detect(Scsi_Host_Template *tpnt)
sym53c416_init(hosts[i].base, hosts[i].scsi_id); sym53c416_init(hosts[i].base, hosts[i].scsi_id);
count++; count++;
spin_unlock_irqrestore(&sym53c416_lock, flags); spin_unlock_irqrestore(&sym53c416_lock, flags);
} continue;
}
} fail_free_host:
scsi_unregister(shpnt);
fail_release_region:
release_region(hosts[i].base, IO_RANGE);
} }
return count; return count;
} }
......
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