From 077aa184ebb4dc3cc52c2dcb1b5ab3e5d4c8d4cc Mon Sep 17 00:00:00 2001 From: Damien Le Moal Date: Tue, 8 Sep 2026 18:02:57 +0900 Subject: [PATCH] scsi: libiscsi: Use combined sense codes Refactor libiscsi to use scsi_set_sense() and replace all hard-coded additional sense codes and additional sense code qualifiers with the enum values defined in include/scsi/scsi_sense.h. This helps with code clarity as the sense codes being processed are easier to test and self-documented. No functional change intended. Signed-off-by: Damien Le Moal Reviewed-by: Johannes Thumshirn Reviewed-by: Hannes Reinecke Link: https://patch.msgid.link/20260908090308.1085097-30-dlemoal@kernel.org Signed-off-by: Martin K. Petersen (Oracle) --- drivers/scsi/libiscsi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 5cbc51899de0..7637aacd6037 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -892,7 +892,8 @@ static void iscsi_scsi_cmd_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr, ascq = session->tt->check_protection(task, §or); if (ascq) { - scsi_build_sense(sc, 1, ILLEGAL_REQUEST, 0x10, ascq); + scsi_set_sense(sc, 1, ILLEGAL_REQUEST, + scsi_sense_code(ASC_ID_CRC_OR_ECC_ERROR, ascq)); scsi_set_sense_information(sc->sense_buffer, SCSI_SENSE_BUFFERSIZE, sector);