Skip to contentSkip to conversation

misc minor SCSI fixes

PATCH New Tim Hockin 1 participant 1 message Oct 16, 2001 SCSI

lore
Share & tools
lore

Tim Hockin

author
#0 lore raw

PATCH 1/1 misc minor SCSI fixes

All,

Attached are a couple minor fixes to the SCSI subsystem. They're all minor, and pretty obvious.

Please apply, or let me know whats wrong with them.

Thanks
Tim

Signature · 4 lines
Tim Hockin
Systems Software Engineer
Sun Microsystems, Cobalt Server Appliances
[email protected]
drivers/scsi/scsi.c +2 -2
diff -ruN dist-2.4.12+patches/drivers/scsi/scsi.c cvs-2.4.12+patches/drivers/scsi/scsi.c
@@ -1836,6 +1837,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.
@@ -1966,8 +1968,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 +5 -0
diff -ruN dist-2.4.12+patches/drivers/scsi/sd.c cvs-2.4.12+patches/drivers/scsi/sd.c
@@ -152,6 +158,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
@@ -533,6 +546,8 @@
 
 	target = DEVICE_NR(inode->i_rdev);
 	SDev = rscsi_disks[target].device;
+	if (!SDev)
+		return -ENODEV;
 
 	SDev->access_count--;