summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/megaraid
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2021-04-27 10:30:13 +0200
committerMartin K. Petersen <martin.petersen@oracle.com>2021-05-31 22:48:21 -0400
commitf2b1e9c6f867ec8f929e96ba4e4010e267587448 (patch)
tree5bf630724f083e7dd2a8e82959d9bb342f0b3644 /drivers/scsi/megaraid
parentced202f7bd78eb6a79c441a8b217e0f3d38bccfc (diff)
downloadlinux-stable-f2b1e9c6f867ec8f929e96ba4e4010e267587448.tar.gz
linux-stable-f2b1e9c6f867ec8f929e96ba4e4010e267587448.tar.bz2
linux-stable-f2b1e9c6f867ec8f929e96ba4e4010e267587448.zip
scsi: core: Introduce scsi_build_sense()
Introduce scsi_build_sense() as a wrapper around scsi_build_sense_buffer() to format the buffer and set the correct SCSI status. Link: https://lore.kernel.org/r/20210427083046.31620-8-hare@suse.de Reviewed-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/megaraid')
-rw-r--r--drivers/scsi/megaraid/megaraid_mbox.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c
index d0aa384adb76..44154e13daa3 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -1574,10 +1574,8 @@ megaraid_mbox_build_cmd(adapter_t *adapter, struct scsi_cmnd *scp, int *busy)
}
if (scp->cmnd[1] & MEGA_SCSI_INQ_EVPD) {
- scp->sense_buffer[0] = 0x70;
- scp->sense_buffer[2] = ILLEGAL_REQUEST;
- scp->sense_buffer[12] = MEGA_INVALID_FIELD_IN_CDB;
- scp->result = CHECK_CONDITION << 1;
+ scsi_build_sense(scp, 0, ILLEGAL_REQUEST,
+ MEGA_INVALID_FIELD_IN_CDB, 0);
return NULL;
}
@@ -2313,11 +2311,9 @@ megaraid_mbox_dpc(unsigned long devp)
scp->result = DRIVER_SENSE << 24 |
DID_OK << 16 |
CHECK_CONDITION << 1;
- } else {
- scp->sense_buffer[0] = 0x70;
- scp->sense_buffer[2] = ABORTED_COMMAND;
- scp->result = CHECK_CONDITION << 1;
- }
+ } else
+ scsi_build_sense(scp, 0,
+ ABORTED_COMMAND, 0, 0);
}
break;