diff options
-rw-r--r-- | drivers/scsi/sr.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index 07ef3db3d1a1..d093dd187b2f 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -177,7 +177,8 @@ static unsigned int sr_get_events(struct scsi_device *sdev) result = scsi_execute_cmd(sdev, cmd, REQ_OP_DRV_IN, buf, sizeof(buf), SR_TIMEOUT, MAX_RETRIES, &exec_args); - if (scsi_sense_valid(&sshdr) && sshdr.sense_key == UNIT_ATTENTION) + if (result > 0 && scsi_sense_valid(&sshdr) && + sshdr.sense_key == UNIT_ATTENTION) return DISK_EVENT_MEDIA_CHANGE; if (result || be16_to_cpu(eh->data_len) < sizeof(*med)) |