diff mbox series

[29/42] mesh: translate message to host byte status

Message ID 20210421174749.11221-30-hare@suse.de
State New
Headers show
Series SCSI result cleanup, part 2 | expand

Commit Message

Hannes Reinecke April 21, 2021, 5:47 p.m. UTC
Instead of setting the message byte translate it to a host byte
status. As the error recovery would map it to DID_ERROR anyway
the translation doesn't change the SCSI error handling.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/scsi/mesh.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/scsi/mesh.c b/drivers/scsi/mesh.c
index 6052a47b03dc..5be587dd75ea 100644
--- a/drivers/scsi/mesh.c
+++ b/drivers/scsi/mesh.c
@@ -597,8 +597,9 @@  static void mesh_done(struct mesh_state *ms, int start_next)
 	if (cmd) {
 		set_host_byte(cmd, ms->stat);
 		set_status_byte(cmd, cmd->SCp.Status);
-		if (ms->stat == DID_OK)
-			set_msg_byte(cmd, cmd->SCp.Message);
+		if (get_host_byte(cmd) == DID_OK &&
+		    cmd->SCp.Message != COMMAND_COMPLETE)
+			translate_msg_byte(cmd, cmd->SCp.Message);
 		if (DEBUG_TARGET(cmd)) {
 			printk(KERN_DEBUG "mesh_done: result = %x, data_ptr=%d, buflen=%d\n",
 			       scsi_get_compat_result(cmd), ms->data_ptr, scsi_bufflen(cmd));