Skip to contentSkip to conversation

make drivers/scsi/qlogicfc.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 make drivers/scsi/qlogicfc.c check_region -> request_region + cleanup (241p9)

Hi.

(I am guessing you as the maintainer of this code. If you are not, I apologize for your inconvenience.)

The following patch makes drivers/scsi/qlogicfc.c check the return code of scsi_register, adds a missing pci64_free_consistent on an error path and makes it use request_region exclusively.

It applies cleanly against ac10 and 241p9.

Comments?

drivers/scsi/qlogicfc.c +6 -2
@@ -756,6 +756,10 @@
 				continue;
 
 		        host = scsi_register(tmpt, sizeof(struct isp2x00_hostdata));
+			if (!host) {
+			        printk("qlogicfc%d : could not register host.\n", hostdata->host_id);
+				continue;
+			}
 			host->max_id = QLOGICFC_MAX_ID + 1;
 			host->max_lun = QLOGICFC_MAX_LUN;
 			host->hostt->use_new_eh_code = 1;
@@ -767,6 +771,7 @@
 
 			if (!hostdata->res){
 			        printk("qlogicfc%d : could not allocate memory for request and response queue.\n", hostdata->host_id);
+				pci64_free_consistent(pdev, RES_SIZE + REQ_SIZE, hostdata->res, busaddr);
 			        scsi_unregister(host);
 				continue;
 			}
@@ -812,7 +817,7 @@
 				scsi_unregister(host);
 				continue;
 			}
-			if (check_region(host->io_port, 0xff)) {
+			if (!request_region(host->io_port, 0xff, "qlogicfc")) {
 			        printk("qlogicfc%d : i/o region 0x%lx-0x%lx already "
 				       "in use\n",
 				       hostdata->host_id, host->io_port, host->io_port + 0xff);
@@ -821,7 +826,6 @@
 				scsi_unregister(host);
 				continue;
 			}
-			request_region(host->io_port, 0xff, "qlogicfc");
 
 			outw(0x0, host->io_port + PCI_SEMAPHORE);
 			outw(HCCR_CLEAR_RISC_INTR, host->io_port + HOST_HCCR);
Signature · 9 lines
Regards,
        Rasmus([email protected])

Open Source. Closed Minds. We are Slashdot. 
  --Anonymous Coward
-
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/