Skip to contentSkip to conversation

make drivers/scsi/sym53c8xx.c check request_region's return code (241p9)]

PATCH In review Rasmus Andersen 2 participants 2 messages Jan 25, 2001 – Jan 28, 2001 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 make drivers/scsi/sym53c8xx.c check request_region's return code (241p9)]

Hi.

I apparently forgot to cc the lists on this one. Replies should be cc'ed to [email protected] also.

Thanks.

----- Forwarded message from Rasmus Andersen <[email protected]> -----

Date: Tue, 23 Jan 2001 23:37:14 +0100
From: Rasmus Andersen <[email protected]>
To: [email protected]
Subject: [PATCH] make drivers/scsi/sym53c8xx.c check request_region's return code (241p9)
User-Agent: Mutt/1.2.4i

Hi.

The following patch makes drivers/scsi/sym53c8xx.c check the return code of request_region. It applies cleanly against ac10 and 241p9.

Please comment.

drivers/scsi/sym53c8xx.c +5 -1
@@ -5817,7 +5817,11 @@
 	*/
 
 	if (device->slot.io_port) {
-		request_region(device->slot.io_port, np->base_ws, NAME53C8XX);
+		if (!request_region(device->slot.io_port, np->base_ws, 
+				    NAME53C8XX)) {
+			printk(KERN_ERR "Cannot mmap IO range.\n");
+			goto attach_error;
+		}
 		np->base_io = device->slot.io_port;
 	}
 
drivers/scsi/sym53c8xx_comm.h +2 -1
@@ -1799,7 +1799,8 @@
 	**    Get access to chip IO registers
 	*/
 #ifdef NCR_IOMAPPED
-	request_region(devp->slot.io_port, 128, NAME53C8XX);
+	if (!request_region(devp->slot.io_port, 128, NAME53C8XX))
+		return;
 	devp->slot.base_io = devp->slot.io_port;
 #else
 	devp->slot.reg = (struct ncr_reg *) remap_pci_mem(devp->slot.base, 128);
Signature · 19 lines
Regards,
        Rasmus([email protected])

It isn't pollution that's harming the environment. It's the impurities in
our air and water that are doing it.  -Former U.S. Vice-President Dan
Quayle

----- End forwarded message -----

-- 
Regards,
        Rasmus([email protected])

Freedom of the press is limited to those who own one.
                                 - A.J. Liebling 
-
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/
#1 lore raw
Quoted 6 lines · Rasmus Andersen

Hi.

I apparently forgot to cc the lists on this one. Replies should be cc'ed to [email protected] also.

Thanks.

The change should not harm, but request_region() is very unlikely to fail here. Reason is that the drivers previously perform a check_region() in order to synchronyze with any other driver that may have attached the same device (candidates are : sym53c8xx, ncr53c8xx, 53c7,8xx)

By the way, as PCI only device drivers, the [sym|ncr]53c8xx drivers want to use MMIO and not normal IO. The 'normal IO' path is here for archs that donnot want to accept MMIO. Note that there are a couple of strangenesses here:

1) The FreeBSD sym driver (derived from sym53c8xx) works with MMIO on FreeBSD/Alpha, but the sym53c8xx fails MMIO under Linux/Alpha.
2) Power/PC port wants drivers to use normal IOs even on machines that only have MMIO.

(2) looks rather a weirdness than a strangeness. :-)

Gérard.

Quoted 67 lines

----- Forwarded message from Rasmus Andersen <[email protected]> -----

Date: Tue, 23 Jan 2001 23:37:14 +0100
From: Rasmus Andersen <[email protected]>
To: [email protected]
Subject: [PATCH] make drivers/scsi/sym53c8xx.c check request_region's return code (241p9)
User-Agent: Mutt/1.2.4i

Hi.

The following patch makes drivers/scsi/sym53c8xx.c check the return code of request_region. It applies cleanly against ac10 and 241p9.

Please comment.

drivers/scsi/sym53c8xx.c +5 -1
@@ -5817,7 +5817,11 @@
 	*/
 
 	if (device->slot.io_port) {
-		request_region(device->slot.io_port, np->base_ws, NAME53C8XX);
+		if (!request_region(device->slot.io_port, np->base_ws, 
+				    NAME53C8XX)) {
+			printk(KERN_ERR "Cannot mmap IO range.\n");
+			goto attach_error;
+		}
 		np->base_io = device->slot.io_port;
 	}
 
drivers/scsi/sym53c8xx_comm.h +2 -1
@@ -1799,7 +1799,8 @@
 	**    Get access to chip IO registers
 	*/
 #ifdef NCR_IOMAPPED
-	request_region(devp->slot.io_port, 128, NAME53C8XX);
+	if (!request_region(devp->slot.io_port, 128, NAME53C8XX))
+		return;
 	devp->slot.base_io = devp->slot.io_port;
 #else
 	devp->slot.reg = (struct ncr_reg *) remap_pci_mem(devp->slot.base, 128);
Signature · 20 lines
-- 
Regards,
        Rasmus([email protected])

It isn't pollution that's harming the environment. It's the impurities in
our air and water that are doing it.  -Former U.S. Vice-President Dan
Quayle

----- End forwarded message -----

-- 
Regards,
        Rasmus([email protected])

Freedom of the press is limited to those who own one.
                                 - A.J. Liebling 
-
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/

-
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/