diff options
-rw-r--r-- | drivers/scsi/scsi_lib.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index e5a9526d2037..f35a0951e469 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -2105,22 +2105,21 @@ scsi_test_unit_ready(struct scsi_device *sdev, int timeout, int retries, | |||
2105 | do { | 2105 | do { |
2106 | result = scsi_execute_req(sdev, cmd, DMA_NONE, NULL, 0, sshdr, | 2106 | result = scsi_execute_req(sdev, cmd, DMA_NONE, NULL, 0, sshdr, |
2107 | timeout, retries); | 2107 | timeout, retries); |
2108 | } while ((driver_byte(result) & DRIVER_SENSE) && | 2108 | if (sdev->removable && scsi_sense_valid(sshdr) && |
2109 | sshdr && sshdr->sense_key == UNIT_ATTENTION && | 2109 | sshdr->sense_key == UNIT_ATTENTION) |
2110 | --retries); | 2110 | sdev->changed = 1; |
2111 | } while (scsi_sense_valid(sshdr) && | ||
2112 | sshdr->sense_key == UNIT_ATTENTION && --retries); | ||
2111 | 2113 | ||
2112 | if (!sshdr) | 2114 | if (!sshdr) |
2113 | /* could not allocate sense buffer, so can't process it */ | 2115 | /* could not allocate sense buffer, so can't process it */ |
2114 | return result; | 2116 | return result; |
2115 | 2117 | ||
2116 | if ((driver_byte(result) & DRIVER_SENSE) && sdev->removable) { | 2118 | if (sdev->removable && scsi_sense_valid(sshdr) && |
2117 | 2119 | (sshdr->sense_key == UNIT_ATTENTION || | |
2118 | if ((scsi_sense_valid(sshdr)) && | 2120 | sshdr->sense_key == NOT_READY)) { |
2119 | ((sshdr->sense_key == UNIT_ATTENTION) || | 2121 | sdev->changed = 1; |
2120 | (sshdr->sense_key == NOT_READY))) { | 2122 | result = 0; |
2121 | sdev->changed = 1; | ||
2122 | result = 0; | ||
2123 | } | ||
2124 | } | 2123 | } |
2125 | if (!sshdr_external) | 2124 | if (!sshdr_external) |
2126 | kfree(sshdr); | 2125 | kfree(sshdr); |