Commit 30d9a4af authored by William Stinson's avatar William Stinson Committed by Jeff Garzik

request_region janitor updates for ultrastor scsi driver:

1) removes calls to check_region 
2) checks the result of request_region calls
3) calls release_region where necessary in case of driver initialisation error 
parent b03eab42
...@@ -371,14 +371,14 @@ static int ultrastor_14f_detect(Scsi_Host_Template * tpnt) ...@@ -371,14 +371,14 @@ static int ultrastor_14f_detect(Scsi_Host_Template * tpnt)
return FALSE; return FALSE;
#ifdef PORT_OVERRIDE #ifdef PORT_OVERRIDE
if(check_region(PORT_OVERRIDE, 0xc)) { if(!request_region(PORT_OVERRIDE, 0xc, "ultrastor")) {
printk("Ultrastor I/O space already in use\n"); printk("Ultrastor I/O space already in use\n");
return FALSE; return FALSE;
}; };
config.port_address = PORT_OVERRIDE; config.port_address = PORT_OVERRIDE;
#else #else
for (i = 0; i < ARRAY_SIZE(ultrastor_ports_14f); i++) { for (i = 0; i < ARRAY_SIZE(ultrastor_ports_14f); i++) {
if(check_region(ultrastor_ports_14f[i], 0x0c)) continue; if(!request_region(ultrastor_ports_14f[i], 0x0c, "ultrastor")) continue;
config.port_address = ultrastor_ports_14f[i]; config.port_address = ultrastor_ports_14f[i];
#endif #endif
...@@ -396,8 +396,9 @@ static int ultrastor_14f_detect(Scsi_Host_Template * tpnt) ...@@ -396,8 +396,9 @@ static int ultrastor_14f_detect(Scsi_Host_Template * tpnt)
# endif # endif
#endif #endif
#ifdef PORT_OVERRIDE #ifdef PORT_OVERRIDE
return FALSE; goto out_release_port;
#else #else
release_region(config.port_address, 0x0c);
continue; continue;
#endif #endif
} }
...@@ -412,8 +413,9 @@ static int ultrastor_14f_detect(Scsi_Host_Template * tpnt) ...@@ -412,8 +413,9 @@ static int ultrastor_14f_detect(Scsi_Host_Template * tpnt)
# endif # endif
#endif #endif
#ifdef PORT_OVERRIDE #ifdef PORT_OVERRIDE
return FALSE; goto out_release_port;
#else #else
release_region(config.port_address, 0x0c);
continue; continue;
#endif #endif
} }
...@@ -425,6 +427,7 @@ static int ultrastor_14f_detect(Scsi_Host_Template * tpnt) ...@@ -425,6 +427,7 @@ static int ultrastor_14f_detect(Scsi_Host_Template * tpnt)
# if (ULTRASTOR_DEBUG & UD_DETECT) # if (ULTRASTOR_DEBUG & UD_DETECT)
printk("US14F: detect: no port address found!\n"); printk("US14F: detect: no port address found!\n");
# endif # endif
/* all ports probed already released - we can just go straight out */
return FALSE; return FALSE;
} }
#endif #endif
...@@ -441,7 +444,6 @@ static int ultrastor_14f_detect(Scsi_Host_Template * tpnt) ...@@ -441,7 +444,6 @@ static int ultrastor_14f_detect(Scsi_Host_Template * tpnt)
/* All above tests passed, must be the right thing. Get some useful /* All above tests passed, must be the right thing. Get some useful
info. */ info. */
request_region(config.port_address, 0x0c,"ultrastor");
/* Register the I/O space that we use */ /* Register the I/O space that we use */
*(char *)&config_1 = inb(CONFIG(config.port_address + 0)); *(char *)&config_1 = inb(CONFIG(config.port_address + 0));
...@@ -465,7 +467,7 @@ static int ultrastor_14f_detect(Scsi_Host_Template * tpnt) ...@@ -465,7 +467,7 @@ static int ultrastor_14f_detect(Scsi_Host_Template * tpnt)
#if (ULTRASTOR_DEBUG & UD_DETECT) #if (ULTRASTOR_DEBUG & UD_DETECT)
printk("US14F: detect: not detected.\n"); printk("US14F: detect: not detected.\n");
#endif #endif
return FALSE; goto out_release_port;
} }
/* Final consistency check, verify previous info. */ /* Final consistency check, verify previous info. */
...@@ -474,7 +476,7 @@ static int ultrastor_14f_detect(Scsi_Host_Template * tpnt) ...@@ -474,7 +476,7 @@ static int ultrastor_14f_detect(Scsi_Host_Template * tpnt)
#if (ULTRASTOR_DEBUG & UD_DETECT) #if (ULTRASTOR_DEBUG & UD_DETECT)
printk("US14F: detect: consistency check failed\n"); printk("US14F: detect: consistency check failed\n");
#endif #endif
return FALSE; goto out_release_port;
} }
/* If we were TRULY paranoid, we could issue a host adapter inquiry /* If we were TRULY paranoid, we could issue a host adapter inquiry
...@@ -507,19 +509,22 @@ static int ultrastor_14f_detect(Scsi_Host_Template * tpnt) ...@@ -507,19 +509,22 @@ static int ultrastor_14f_detect(Scsi_Host_Template * tpnt)
if (request_irq(config.interrupt, do_ultrastor_interrupt, 0, "Ultrastor", &config.mscp[0].SCint->host)) { if (request_irq(config.interrupt, do_ultrastor_interrupt, 0, "Ultrastor", &config.mscp[0].SCint->host)) {
printk("Unable to allocate IRQ%u for UltraStor controller.\n", printk("Unable to allocate IRQ%u for UltraStor controller.\n",
config.interrupt); config.interrupt);
return FALSE; goto out_release_port;
} }
if (config.dma_channel && request_dma(config.dma_channel,"Ultrastor")) { if (config.dma_channel && request_dma(config.dma_channel,"Ultrastor")) {
printk("Unable to allocate DMA channel %u for UltraStor controller.\n", printk("Unable to allocate DMA channel %u for UltraStor controller.\n",
config.dma_channel); config.dma_channel);
free_irq(config.interrupt, NULL); free_irq(config.interrupt, NULL);
return FALSE; goto out_release_port;
} }
tpnt->sg_tablesize = ULTRASTOR_14F_MAX_SG; tpnt->sg_tablesize = ULTRASTOR_14F_MAX_SG;
printk("UltraStor driver version" VERSION ". Using %d SG lists.\n", printk("UltraStor driver version" VERSION ". Using %d SG lists.\n",
ULTRASTOR_14F_MAX_SG); ULTRASTOR_14F_MAX_SG);
return TRUE; return TRUE;
out_release_port:
release_region(config.port_address, 0x0c);
return FALSE;
} }
static int ultrastor_24f_detect(Scsi_Host_Template * tpnt) static int ultrastor_24f_detect(Scsi_Host_Template * tpnt)
......
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