Skip to contentSkip to conversation

scsi-sysfs bug fix

PATCH New Robert Love 1 participant 1 message Mar 19, 2003 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi-sysfs bug fix

[ Apologies for sending this to all the usual suspects here ... ]

drivers/scsi/scsi_sysfs.c :: store_rescan_field() calls scsi_rescan_device() without a prototype, and thus results in a compiler warning.

Fix that up by adding the prototype to scsi.h, where it belongs.

But then we see we are storing the return value of a void function (so that is why ANSI C is good)... so fix that up, too, by setting the return value to zero if a valid device was found. Otherwise, return ENODEV as before.

Patch is against 2.5.65.

Robert Love

 drivers/scsi/scsi.h       |    1 +
 drivers/scsi/scsi_sysfs.c |    6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/scsi/scsi.h +1 -0
diff -urN linux-2.5.65/drivers/scsi/scsi.h linux/drivers/scsi/scsi.h
@@ -443,6 +443,7 @@
 extern int scsi_attach_device(struct scsi_device *);
 extern void scsi_detach_device(struct scsi_device *);
 extern int scsi_get_device_flags(unsigned char *vendor, unsigned char *model);
+extern void scsi_rescan_device(struct scsi_device *sdev);
 
 /*
  * Newer request-based interfaces.
drivers/scsi/scsi_sysfs.c +4 -2
diff -urN linux-2.5.65/drivers/scsi/scsi_sysfs.c linux/drivers/scsi/scsi_sysfs.c
@@ -278,8 +278,10 @@
 	int ret = ENODEV;
 	struct scsi_device *sdev;
 	sdev = to_scsi_device(dev);
-	if (sdev)
-		ret = scsi_rescan_device(sdev);
+	if (sdev) {
+		ret = 0;
+		scsi_rescan_device(sdev);
+	}
 	return ret;
 }