diff options
Diffstat (limited to 'scsi/utils.c')
-rw-r--r-- | scsi/utils.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/scsi/utils.c b/scsi/utils.c index ddae650a99..8738522955 100644 --- a/scsi/utils.c +++ b/scsi/utils.c @@ -322,18 +322,18 @@ int scsi_convert_sense(uint8_t *in_buf, int in_len, SCSISense sense; bool fixed_in; + if (in_len == 0) { + return scsi_build_sense_buf(buf, len, SENSE_CODE(NO_SENSE), fixed); + } + fixed_in = (in_buf[0] & 2) == 0; - if (in_len && fixed == fixed_in) { + if (fixed == fixed_in) { memcpy(buf, in_buf, MIN(len, in_len)); return MIN(len, in_len); - } - - if (in_len == 0) { - sense = SENSE_CODE(NO_SENSE); } else { sense = scsi_parse_sense_buf(in_buf, in_len); + return scsi_build_sense_buf(buf, len, sense, fixed); } - return scsi_build_sense_buf(buf, len, sense, fixed); } int scsi_sense_to_errno(int key, int asc, int ascq) |