Skip to contentSkip to conversation

drivers/scsi/fd_mcs.c cleanup (241p9)

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

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/scsi/fd_mcs.c cleanup (241p9)

Hi.

(I am guessing you as maintainer of this code. If you are not, I apologise.)

The following patch makes drivers/scsi/fd_mcs.c use the return code of request_region instead of check_region. It also makes the driver release the irq on error. It applies cleanly against ac10 and 241p9.

Comments?

drivers/scsi/fd_mcs.c +15 -8
@@ -406,23 +406,24 @@
 	/* claim the slot */
 	mca_set_adapter_name( slot-1, fd_mcs_adapters[loop].name );
 
-	/* check irq/region */
-	if (check_region(port, 0x10) ||
-	    request_irq(irq, fd_mcs_intr,
-			SA_SHIRQ, "fd_mcs", hosts)) {
-	  printk( "fd_mcs: check_region() || request_irq() failed, Skip it\n");
-
+	/* check/get irq/region */
+	if (!request_region(port, 0x10, "fd_mcs") ) {
+	  printk(KERN_WARNING "fd_mcs: request_region() failed, Skip it\n");
 	  continue;
 	}
+		
+	if (request_irq(irq, fd_mcs_intr, SA_SHIRQ, "fd_mcs", hosts)) {
+	  printk(KERN_WARNING "fd_mcs: request_irq() failed, Skip it\n");
+	  goto err_release;
+	}
 
 	/* register */
 	if (!(shpnt = scsi_register(tpnt, sizeof(struct fd_hostdata)))) {
 	  printk( "fd_mcs: scsi_register() failed\n");
-	  continue;
+	  goto err_free_irq;
 	}
 
 	/* request I/O region */
-	request_region( port, 0x10, "fd_mcs" );
 
 	/* save name */
 	strcpy(adapter_name, fd_mcs_adapters[loop].name);
@@ -578,6 +579,12 @@
 	      FD_MAX_HOSTS);
       break;
     }
+    continue;
+
+  err_free_irq:
+    free_irq(irq, fd_mcs_intr);
+  err_release:
+    release_region(port, 0x10);
   }
 
   return found;
Signature · 10 lines
Regards,
        Rasmus([email protected])

Three things are certain:
Death, taxes, and lost data.
Guess which has occurred. --- Error messages in haiku
-
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/