Re: [PATCH RFC] sd: spin down disks on removal or power-down

From: Robert Hancock
Date: Mon Jan 29 2007 - 18:57:31 EST


Andrew Morton wrote:
triviata:

--- linux-2.6.20-rc6nv/drivers/scsi/sd.c 2007-01-28 17:00:00.000000000 -0600
+++ linux-2.6.20-rc6nvedit/drivers/scsi/sd.c 2007-01-28 18:08:53.000000000 -0600
@@ -821,6 +821,39 @@ static int sd_sync_cache(struct scsi_dev
return res;
}
+static int sd_stop_unit(struct scsi_device *sdp, struct scsi_disk* sdkp)

s/* / */

+{
+ int res;
+ struct scsi_sense_hdr sshdr;
+ unsigned char cmd[10] = { 0 };

I don't think this initialisation-to-all-zeroes is needed, is it?

Pretty sure it is, the rest of the command needs to be set to 0. Without it the other 9 bytes will contain uninitialized junk.

For the other cleanup changes, though:

Signed-off-by: Robert Hancock <hancockr@xxxxxxx>

--
Robert Hancock Saskatoon, SK, Canada
To email, remove "nospam" from hancockr@xxxxxxxxxxxxx
Home Page: http://www.roberthancock.com/



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/