From: Robert Elliott Date: Thu, 3 Jul 2014 15:18:19 +0000 (-0500) Subject: hpsa: do not unconditionally copy sense data X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=6aa4c361bf8b1f08b34fb6c581db352d7f7cff46;p=linux-beck.git hpsa: do not unconditionally copy sense data Signed-off-by: Robert Elliott Signed-off-by: Stephen M. Cameron Reviewed-by: Stephen M. Cameron Signed-off-by: Christoph Hellwig --- diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 6edd2aaacbab..10aed7dae609 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c @@ -1708,7 +1708,14 @@ static void complete_scsi_command(struct CommandList *cp) cmd->result |= ei->ScsiStatus; - /* copy the sense data whether we need to or not. */ + scsi_set_resid(cmd, ei->ResidualCnt); + if (ei->CommandStatus == 0) { + cmd_free(h, cp); + cmd->scsi_done(cmd); + return; + } + + /* copy the sense data */ if (SCSI_SENSE_BUFFERSIZE < sizeof(ei->SenseInfo)) sense_data_size = SCSI_SENSE_BUFFERSIZE; else @@ -1717,13 +1724,6 @@ static void complete_scsi_command(struct CommandList *cp) sense_data_size = ei->SenseLen; memcpy(cmd->sense_buffer, ei->SenseInfo, sense_data_size); - scsi_set_resid(cmd, ei->ResidualCnt); - - if (ei->CommandStatus == 0) { - cmd_free(h, cp); - cmd->scsi_done(cmd); - return; - } /* For I/O accelerator commands, copy over some fields to the normal * CISS header used below for error handling.