Skip to contentSkip to conversation

Minor misc SCSI tweaks

PATCH In review Tim Hockin 2 participants 2 messages Jul 10, 2001 SCSI

lore
Share & tools
lore

Tim Hockin

author
#0 lore raw

PATCH 1/1 Minor misc SCSI tweaks

All,

Attached is a small patch fixing some minor misc. SCSI issues (Duncan Laurie's work). These are against 2.4.6, for general inclusion.

Tim

Signature · 4 lines
Tim Hockin
Systems Software Engineer
Sun Microsystems, Cobalt Server Appliances
[email protected]
drivers/scsi/scsi.c +3 -3
diff -ruN dist-2.4.6/drivers/scsi/scsi.c cobalt-2.4.6/drivers/scsi/scsi.c
@@ -82,7 +82,7 @@
 #endif
 
 /*
-   static const char RCSid[] = "$Header: /vger/u4/cvs/linux/drivers/scsi/scsi.c,v 1.38 1997/01/19 23:07:18 davem Exp $";
+   static const char RCSid[] = "$Header: /home/cvs/linux-2.4/drivers/scsi/scsi.c,v 1.1.1.4 2001/05/30 01:05:04 thockin Exp $";
  */
 
 /*
@@ -1823,6 +1823,8 @@
 				 */
 	pcount = next_scsi_host;
 
+	MOD_INC_USE_COUNT;
+
 	/* The detect routine must carefully spinunlock/spinlock if 
 	   it enables interrupts, since all interrupt handlers do 
 	   spinlock as well.
@@ -1952,8 +1954,6 @@
 	       (scsi_init_memory_start - scsi_memory_lower_value) / 1024,
 	       (scsi_memory_upper_value - scsi_init_memory_start) / 1024);
 #endif
-
-	MOD_INC_USE_COUNT;
 
 	if (out_of_space) {
 		scsi_unregister_host(tpnt);	/* easiest way to clean up?? */
drivers/scsi/sd.c +12 -0
diff -ruN dist-2.4.6/drivers/scsi/sd.c cobalt-2.4.6/drivers/scsi/sd.c
@@ -145,6 +151,9 @@
 	int diskinfo[4];
     
 	SDev = rscsi_disks[DEVICE_NR(dev)].device;
+	if (!SDev)
+		return -ENODEV;
+
 	/*
 	 * If we are in the middle of error recovery, don't let anyone
 	 * else try and use this device.  Also, if error recovery fails, it
@@ -502,6 +515,8 @@
 
 	target = DEVICE_NR(inode->i_rdev);
 	SDev = rscsi_disks[target].device;
+	if (!SDev)
+		return -ENODEV;
 
 	SDev->access_count--;
 
@@ -734,8 +759,15 @@
 	 */
 
 	SRpnt = scsi_allocate_request(rscsi_disks[i].device);
+	if (!SRpnt)
+		return i;
 
 	buffer = (unsigned char *) scsi_malloc(512);
+	if (!buffer) {
+		scsi_release_request(SRpnt);
+		SRpnt = NULL;
+		return i;
+	}
 
 	spintime = 0;
 
#1 lore raw
Quoted 2 lines

Attached is a small patch fixing some minor misc. SCSI issues (Duncan Laurie's work). These are against 2.4.6, for general inclusion.

Please recheck against 2.4.7pre-curent. There are a lotof scsi fixups done there and they probably deal with most of the stuff you are also patching