public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Stephen M. Cameron" <scameron@beardog.cce.hp.com>
To: james.bottomley@parallels.com
Cc: martin.petersen@oracle.com, linux-scsi@vger.kernel.org,
	stephenmcameron@gmail.com, joseph.t.handzik@hp.com,
	thenzl@redhat.com, michael.miller@canonical.com, elliott@hp.com,
	scott.teel@hp.com, hch@lst.de
Subject: [PATCH 5/5] hpsa: do not unconditionally copy sense data
Date: Thu, 03 Jul 2014 10:18:19 -0500	[thread overview]
Message-ID: <20140703151819.22132.96424.stgit@beardog.cce.hp.com> (raw)
In-Reply-To: <20140703151534.22132.49663.stgit@beardog.cce.hp.com>

From: Robert Elliott <elliott@hp.com>

Signed-off-by: Robert Elliott <elliott@hp.com>
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Reviewed-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
---
 drivers/scsi/hpsa.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index a97a7ff..f937ea9 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.


  parent reply	other threads:[~2014-07-03 15:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-03 15:17 [PATCH 0/5] hpsa a few small updates for early July 2014 Stephen M. Cameron
2014-07-03 15:17 ` [PATCH 1/5] hpsa: remove online devices from offline device list Stephen M. Cameron
2014-07-03 15:18 ` [PATCH 2/5] hpsa: fix bad -ENOMEM return value in hpsa_big_passthru_ioctl Stephen M. Cameron
2014-07-03 15:18 ` [PATCH 3/5] hpsa: make hpsa_init_one return -ENOMEM if allocation of h->lockup_detected fails Stephen M. Cameron
2014-07-03 15:18 ` [PATCH 4/5] hpsa: fix 6-byte READ/WRITE with 0 length data xfer Stephen M. Cameron
2014-07-03 15:18 ` Stephen M. Cameron [this message]
2014-07-03 17:31 ` [PATCH 0/5] hpsa a few small updates for early July 2014 Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140703151819.22132.96424.stgit@beardog.cce.hp.com \
    --to=scameron@beardog.cce.hp.com \
    --cc=elliott@hp.com \
    --cc=hch@lst.de \
    --cc=james.bottomley@parallels.com \
    --cc=joseph.t.handzik@hp.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=michael.miller@canonical.com \
    --cc=scott.teel@hp.com \
    --cc=stephenmcameron@gmail.com \
    --cc=thenzl@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox