diff options
author | Hannes Reinecke <hare@suse.de> | 2021-04-27 10:30:13 +0200 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2021-05-31 22:48:21 -0400 |
commit | f2b1e9c6f867ec8f929e96ba4e4010e267587448 (patch) | |
tree | 5bf630724f083e7dd2a8e82959d9bb342f0b3644 /drivers/scsi/scsi_debug.c | |
parent | ced202f7bd78eb6a79c441a8b217e0f3d38bccfc (diff) |
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/scsi_debug.c')
-rw-r--r-- | drivers/scsi/scsi_debug.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 6e2ad003c179..a49fbd96a510 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -931,7 +931,7 @@ static void mk_sense_invalid_fld(struct scsi_cmnd *scp, } asc = c_d ? INVALID_FIELD_IN_CDB : INVALID_FIELD_IN_PARAM_LIST; memset(sbuff, 0, SCSI_SENSE_BUFFERSIZE); - scsi_build_sense_buffer(sdebug_dsense, sbuff, ILLEGAL_REQUEST, asc, 0); + scsi_build_sense(scp, sdebug_dsense, ILLEGAL_REQUEST, asc, 0); memset(sks, 0, sizeof(sks)); sks[0] = 0x80; if (c_d) @@ -957,17 +957,14 @@ static void mk_sense_invalid_fld(struct scsi_cmnd *scp, static void mk_sense_buffer(struct scsi_cmnd *scp, int key, int asc, int asq) { - unsigned char *sbuff; - - sbuff = scp->sense_buffer; - if (!sbuff) { + if (!scp->sense_buffer) { sdev_printk(KERN_ERR, scp->device, "%s: sense_buffer is NULL\n", __func__); return; } - memset(sbuff, 0, SCSI_SENSE_BUFFERSIZE); + memset(scp->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); - scsi_build_sense_buffer(sdebug_dsense, sbuff, key, asc, asq); + scsi_build_sense(scp, sdebug_dsense, key, asc, asq); if (sdebug_verbose) sdev_printk(KERN_INFO, scp->device, |