aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/sr_ioctl.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/scsi/sr_ioctl.c b/drivers/scsi/sr_ioctl.c
index 2a21f2d48592..35fab1e18adc 100644
--- a/drivers/scsi/sr_ioctl.c
+++ b/drivers/scsi/sr_ioctl.c
@@ -188,9 +188,13 @@ int sr_do_ioctl(Scsi_CD *cd, struct packet_command *cgc)
188 struct scsi_device *SDev; 188 struct scsi_device *SDev;
189 struct scsi_sense_hdr sshdr; 189 struct scsi_sense_hdr sshdr;
190 int result, err = 0, retries = 0; 190 int result, err = 0, retries = 0;
191 unsigned char sense_buffer[SCSI_SENSE_BUFFERSIZE], *senseptr = NULL;
191 192
192 SDev = cd->device; 193 SDev = cd->device;
193 194
195 if (cgc->sense)
196 senseptr = sense_buffer;
197
194 retry: 198 retry:
195 if (!scsi_block_when_processing_errors(SDev)) { 199 if (!scsi_block_when_processing_errors(SDev)) {
196 err = -ENODEV; 200 err = -ENODEV;
@@ -198,10 +202,12 @@ int sr_do_ioctl(Scsi_CD *cd, struct packet_command *cgc)
198 } 202 }
199 203
200 result = scsi_execute(SDev, cgc->cmd, cgc->data_direction, 204 result = scsi_execute(SDev, cgc->cmd, cgc->data_direction,
201 cgc->buffer, cgc->buflen, 205 cgc->buffer, cgc->buflen, senseptr, &sshdr,
202 (unsigned char *)cgc->sense, &sshdr,
203 cgc->timeout, IOCTL_RETRIES, 0, 0, NULL); 206 cgc->timeout, IOCTL_RETRIES, 0, 0, NULL);
204 207
208 if (cgc->sense)
209 memcpy(cgc->sense, sense_buffer, sizeof(*cgc->sense));
210
205 /* Minimal error checking. Ignore cases we know about, and report the rest. */ 211 /* Minimal error checking. Ignore cases we know about, and report the rest. */
206 if (driver_byte(result) != 0) { 212 if (driver_byte(result) != 0) {
207 switch (sshdr.sense_key) { 213 switch (sshdr.sense_key) {