]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[SCSI] sg: fix /proc/scsi/sg/devices when no SCSI devices
authorTony Battersby <tonyb@cybernetics.com>
Tue, 22 Jan 2008 20:25:49 +0000 (15:25 -0500)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Wed, 23 Jan 2008 19:40:55 +0000 (13:40 -0600)
The patch "[SCSI] sg: use idr to replace static arrays" in 2.6.24-rc1
causes a bogus line to appear in /proc/scsi/sg/devices containing
"-1 -1 -1 -1 -1 -1 -1 -1 -1" when there are no SCSI devices in the
system.  In 2.6.23, /proc/scsi/sg/devices is empty when there are no
SCSI devices in the system.  A similar problem exists with
/proc/scsi/sg/device_strs.  The following patch restores the behavior
of 2.6.23.

Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
Acked-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
drivers/scsi/sg.c

index 78ac48df4de8fee6d9978fdd8f15475b56f74632..17216b76efdcbd72a0b5c141e3245c09e992d17d 100644 (file)
@@ -2529,7 +2529,7 @@ sg_idr_max_id(int id, void *p, void *data)
 static int
 sg_last_dev(void)
 {
-       int k = 0;
+       int k = -1;
        unsigned long iflags;
 
        read_lock_irqsave(&sg_index_lock, iflags);