Skip to contentSkip to conversation

drivers/scsi/qlogicfas.c: check_region -> request_region + cleanup (241p9)

PATCH New Rasmus Andersen 1 participant 1 message Jan 23, 2001 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/scsi/qlogicfas.c: check_region -> request_region + cleanup (241p9)

Hi.

(I have not been able to find a probable maintainer for this code.)

The follow patch makes drivers/scsi/qlogicfas.c use the return code from request_region instead of a call to check_region. It also adds a missing free_irq on an error path and makes us check the return from scsi_register.

It applies cleanly against ac10 and 241p9.

Comments?

drivers/scsi/qlogicfas.c +11 -3
@@ -132,7 +132,7 @@
 
 /*----------------------------------------------------------------*/
 /* driver state info, local to driver */
-static int	    qbase = 0;	/* Port */
+static int	    qbase;	/* Port */
 static int	    qinitid;	/* initiator ID */
 static int	    qabort;	/* Flag to cause an abort */
 static int	    qlirq = -1;	/* IRQ being used */
@@ -556,7 +556,7 @@
 
 	if( !qbase ) {
 		for (qbase = 0x230; qbase < 0x430; qbase += 0x100) {
-			if( check_region( qbase , 0x10 ) )
+			if( !request_region( qbase , 0x10, "qlogicfas" ) )
 				continue;
 			REG1;
 			if ( ( (inb(qbase + 0xe) ^ inb(qbase + 0xe)) == 7 )
@@ -616,8 +616,9 @@
 	if (qlirq >= 0 && !request_irq(qlirq, do_ql_ihandl, 0, "qlogicfas", NULL))
 		host->can_queue = 1;
 #endif
-	request_region( qbase , 0x10 ,"qlogicfas");
 	hreg = scsi_register( host , 0 );	/* no host data */
+	if (!hreg)
+		goto err_release_mem;
 	hreg->io_port = qbase;
 	hreg->n_io_port = 16;
 	hreg->dma_channel = -1;
@@ -629,6 +630,13 @@
 	host->name = qinfo;
 
 	return 1;
+
+ err_release_mem:
+	release_region(qbase, 0x10);
+	if (host->can_queue)
+		free_irq(qlirq, do_ql_ihandl);
+	return 0;
+
 }
 
 /*----------------------------------------------------------------*/
Signature · 9 lines
Regards,
        Rasmus([email protected])

The president has kept all of the promises he intended to keep.
-Clinton aide George Stephanopolous speaking on "Larry King Live".
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/