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

Hannes Reinecke
2021-04-21T17:48:52Z

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 --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));
--
2.29.2