Commit 7a6873be authored by Kees Cook's avatar Kees Cook Committed by Jens Axboe

ide-cd: Remove redundant sense buffer

This is already able to process the sense buffer, so remove the redundant
parsing during the failure path. This also fixes any possible stale values
since the prior code did not check the sense length.
Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent e7d0748d
...@@ -423,6 +423,7 @@ int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd, ...@@ -423,6 +423,7 @@ int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd,
req_flags_t rq_flags) req_flags_t rq_flags)
{ {
struct cdrom_info *info = drive->driver_data; struct cdrom_info *info = drive->driver_data;
struct scsi_sense_hdr local_sshdr;
int retries = 10; int retries = 10;
bool failed; bool failed;
...@@ -430,6 +431,9 @@ int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd, ...@@ -430,6 +431,9 @@ int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd,
"rq_flags: 0x%x", "rq_flags: 0x%x",
cmd[0], write, timeout, rq_flags); cmd[0], write, timeout, rq_flags);
if (!sshdr)
sshdr = &local_sshdr;
/* start of retry loop */ /* start of retry loop */
do { do {
struct request *rq; struct request *rq;
...@@ -456,9 +460,8 @@ int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd, ...@@ -456,9 +460,8 @@ int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd,
if (buffer) if (buffer)
*bufflen = scsi_req(rq)->resid_len; *bufflen = scsi_req(rq)->resid_len;
if (sshdr) scsi_normalize_sense(scsi_req(rq)->sense,
scsi_normalize_sense(scsi_req(rq)->sense, scsi_req(rq)->sense_len, sshdr);
scsi_req(rq)->sense_len, sshdr);
/* /*
* FIXME: we should probably abort/retry or something in case of * FIXME: we should probably abort/retry or something in case of
...@@ -470,12 +473,10 @@ int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd, ...@@ -470,12 +473,10 @@ int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd,
* The request failed. Retry if it was due to a unit * The request failed. Retry if it was due to a unit
* attention status (usually means media was changed). * attention status (usually means media was changed).
*/ */
struct request_sense *reqbuf = scsi_req(rq)->sense; if (sshdr->sense_key == UNIT_ATTENTION)
if (reqbuf->sense_key == UNIT_ATTENTION)
cdrom_saw_media_change(drive); cdrom_saw_media_change(drive);
else if (reqbuf->sense_key == NOT_READY && else if (sshdr->sense_key == NOT_READY &&
reqbuf->asc == 4 && reqbuf->ascq != 4) { sshdr->asc == 4 && sshdr->ascq != 4) {
/* /*
* The drive is in the process of loading * The drive is in the process of loading
* a disk. Retry, but wait a little to give * a disk. Retry, but wait a little to give
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment