diff mbox

[VERY,EARLY,RFC,12/13] reewide: introduce clear_scsi_result() and convert drivers

Message ID 20180418150116.18807-13-jthumshirn@suse.de (mailing list archive)
State Changes Requested
Headers show

Commit Message

Johannes Thumshirn April 18, 2018, 3:01 p.m. UTC
Introduce clear_scsi_result() and convert drivers over to use the new
function.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
 arch/ia64/hp/sim/simscsi.c                      |  4 +-
 drivers/ata/libata-scsi.c                       |  8 +--
 drivers/infiniband/ulp/srp/ib_srp.c             |  2 +-
 drivers/message/fusion/mptfc.c                  |  4 +-
 drivers/message/fusion/mptsas.c                 |  2 +-
 drivers/message/fusion/mptscsih.c               | 52 +++++++++----------
 drivers/message/fusion/mptspi.c                 |  4 +-
 drivers/s390/scsi/zfcp_scsi.c                   |  2 +-
 drivers/scsi/3w-9xxx.c                          |  8 +--
 drivers/scsi/3w-sas.c                           |  6 +--
 drivers/scsi/3w-xxxx.c                          | 14 +++---
 drivers/scsi/53c700.c                           |  2 +-
 drivers/scsi/BusLogic.c                         | 12 ++---
 drivers/scsi/NCR5380.c                          | 20 ++++----
 drivers/scsi/aacraid/aachba.c                   | 10 ++--
 drivers/scsi/aacraid/linit.c                    |  4 +-
 drivers/scsi/advansys.c                         |  4 +-
 drivers/scsi/aha152x.c                          |  2 +-
 drivers/scsi/aha1542.c                          |  2 +-
 drivers/scsi/aha1740.c                          |  2 +-
 drivers/scsi/aic7xxx/aic79xx_osm.c              |  2 +-
 drivers/scsi/aic7xxx/aic7xxx_osm.c              |  2 +-
 drivers/scsi/arcmsr/arcmsr_hba.c                | 30 +++++------
 drivers/scsi/arm/acornscsi.c                    |  6 +--
 drivers/scsi/arm/fas216.c                       |  2 +-
 drivers/scsi/atp870u.c                          |  8 +--
 drivers/scsi/bfa/bfad_im.c                      |  4 +-
 drivers/scsi/bnx2fc/bnx2fc_io.c                 |  6 +--
 drivers/scsi/csiostor/csio_scsi.c               |  4 +-
 drivers/scsi/cxlflash/main.c                    | 24 ++++-----
 drivers/scsi/dc395x.c                           | 10 ++--
 drivers/scsi/dpt_i2o.c                          | 24 ++++-----
 drivers/scsi/esas2r/esas2r_main.c               |  8 +--
 drivers/scsi/esp_scsi.c                         |  6 +--
 drivers/scsi/fnic/fnic_scsi.c                   | 16 +++---
 drivers/scsi/gdth.c                             | 14 +++---
 drivers/scsi/hpsa.c                             | 50 +++++++++----------
 drivers/scsi/hptiop.c                           | 16 +++---
 drivers/scsi/ibmvscsi/ibmvfc.c                  | 12 ++---
 drivers/scsi/ibmvscsi/ibmvscsi.c                | 12 ++---
 drivers/scsi/imm.c                              |  4 +-
 drivers/scsi/ipr.c                              |  4 +-
 drivers/scsi/ips.c                              | 66 ++++++++++++-------------
 drivers/scsi/libfc/fc_fcp.c                     | 22 ++++-----
 drivers/scsi/libiscsi.c                         | 30 +++++------
 drivers/scsi/libsas/sas_scsi_host.c             |  6 +--
 drivers/scsi/lpfc/lpfc_scsi.c                   | 12 ++---
 drivers/scsi/megaraid.c                         | 26 +++++-----
 drivers/scsi/megaraid/megaraid_mbox.c           | 38 +++++++-------
 drivers/scsi/megaraid/megaraid_sas_base.c       | 24 ++++-----
 drivers/scsi/megaraid/megaraid_sas_fusion.c     | 12 ++---
 drivers/scsi/mesh.c                             |  4 +-
 drivers/scsi/mpt3sas/mpt3sas_scsih.c            | 64 ++++++++++++------------
 drivers/scsi/mvumi.c                            |  2 +-
 drivers/scsi/nsp32.c                            | 32 ++++++------
 drivers/scsi/pcmcia/nsp_cs.c                    | 10 ++--
 drivers/scsi/pcmcia/sym53c500_cs.c              | 10 ++--
 drivers/scsi/pmcraid.c                          |  4 +-
 drivers/scsi/ppa.c                              |  6 +--
 drivers/scsi/ps3rom.c                           |  4 +-
 drivers/scsi/qedf/qedf_io.c                     |  8 +--
 drivers/scsi/qla1280.c                          |  2 +-
 drivers/scsi/qla2xxx/qla_iocb.c                 |  4 +-
 drivers/scsi/qla2xxx/qla_isr.c                  |  2 +-
 drivers/scsi/qla2xxx/qla_os.c                   | 16 +++---
 drivers/scsi/qla4xxx/ql4_isr.c                  | 24 ++++-----
 drivers/scsi/qla4xxx/ql4_os.c                   |  6 +--
 drivers/scsi/qlogicfas408.c                     |  2 +-
 drivers/scsi/qlogicpti.c                        |  2 +-
 drivers/scsi/scsi_error.c                       |  2 +-
 drivers/scsi/scsi_lib.c                         | 10 ++--
 drivers/scsi/sd.c                               |  2 +-
 drivers/scsi/smartpqi/smartpqi_init.c           |  4 +-
 drivers/scsi/snic/snic_scsi.c                   |  8 +--
 drivers/scsi/stex.c                             |  6 +--
 drivers/scsi/storvsc_drv.c                      |  2 +-
 drivers/scsi/vmw_pvscsi.c                       | 20 ++++----
 drivers/scsi/wd33c93.c                          | 10 ++--
 drivers/scsi/wd719x.c                           |  2 +-
 drivers/scsi/xen-scsifront.c                    |  4 +-
 drivers/staging/rts5208/rtsx.c                  |  2 +-
 drivers/staging/rts5208/rtsx_transport.c        |  4 +-
 drivers/staging/unisys/visorhba/visorhba_main.c |  8 +--
 drivers/usb/image/microtek.c                    |  4 +-
 drivers/usb/storage/isd200.c                    | 12 ++---
 drivers/usb/storage/scsiglue.c                  |  2 +-
 drivers/usb/storage/transport.c                 | 14 +++---
 drivers/usb/storage/uas.c                       | 12 ++---
 drivers/usb/storage/usb.c                       |  8 +--
 include/scsi/scsi_cmnd.h                        |  5 ++
 90 files changed, 506 insertions(+), 501 deletions(-)

Comments

Hannes Reinecke April 19, 2018, 6:15 a.m. UTC | #1
On Wed, 18 Apr 2018 17:01:15 +0200
Johannes Thumshirn <jthumshirn@suse.de> wrote:

> Introduce clear_scsi_result() and convert drivers over to use the new
> function.
> 

[ .. ]

Why not use 'set_scsi_result' here?
Basically everywhere the usage pattern is

clear_scsi_result()
set_host_byte()

so they can be collapsed into

set_scsi_result(cmd, 0, host_byte, 0, 0)

and this helper can be dropped.

Cheers,

Hannes
Johannes Thumshirn April 19, 2018, 8:21 a.m. UTC | #2
On Thu, Apr 19, 2018 at 08:15:47AM +0200, Hannes Reinecke wrote:
> On Wed, 18 Apr 2018 17:01:15 +0200
> Johannes Thumshirn <jthumshirn@suse.de> wrote:
> 
> > Introduce clear_scsi_result() and convert drivers over to use the new
> > function.
> > 
> 
> [ .. ]
> 
> Why not use 'set_scsi_result' here?
> Basically everywhere the usage pattern is
> 
> clear_scsi_result()
> set_host_byte()
> 
> so they can be collapsed into
> 
> set_scsi_result(cmd, 0, host_byte, 0, 0)
> 
> and this helper can be dropped.

Yup, this sounds like a good idea.
diff mbox

Patch

diff --git a/arch/ia64/hp/sim/simscsi.c b/arch/ia64/hp/sim/simscsi.c
index ecb158acba71..582a5c9e3604 100644
--- a/arch/ia64/hp/sim/simscsi.c
+++ b/arch/ia64/hp/sim/simscsi.c
@@ -143,7 +143,7 @@  simscsi_sg_readwrite (struct scsi_cmnd *sc, int mode, unsigned long offset)
 
 		/* should not happen in our case */
 		if (stat.count != req.len) {
-			sc->result = 0;
+			clear_scsi_result(sc);
 			set_host_byte(sc, DID_ERROR);
 			return;
 		}
@@ -219,7 +219,7 @@  simscsi_queuecommand_lck (struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *)
 		       target_id, sc->cmnd[0], sc->serial_number, sp, done);
 #endif
 
-	sc->result = 0;
+	clear_scsi_result(sc);
 	set_host_byte(sc, DID_BAD_TARGET);
 	sc->scsi_done = done;
 	if (target_id <= 15 && sc->device->lun == 0) {
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 96cd5c838c89..b8fcb8442f97 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -2034,7 +2034,7 @@  static int ata_scsi_translate(struct ata_device *dev, struct scsi_cmnd *cmd,
 
 err_did:
 	ata_qc_free(qc);
-	cmd->result = 0;
+	clear_scsi_result(cmd);
 	set_host_byte(cmd, DID_ERROR);
 	cmd->scsi_done(cmd);
 err_mem:
@@ -4341,7 +4341,7 @@  static inline int __ata_scsi_queuecmd(struct scsi_cmnd *scmd,
  bad_cdb_len:
 	DPRINTK("bad CDB len=%u, scsi_op=0x%02x, max=%u\n",
 		scmd->cmd_len, scsi_op, dev->cdb_len);
-	scmd->result = 0;
+	clear_scsi_result(scmd);
 	set_host_byte(scmd, DID_ERROR);
 	scmd->scsi_done(scmd);
 	return 0;
@@ -4384,7 +4384,7 @@  int ata_scsi_queuecmd(struct Scsi_Host *shost, struct scsi_cmnd *cmd)
 	if (likely(dev))
 		rc = __ata_scsi_queuecmd(cmd, dev);
 	else {
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_BAD_TARGET);
 		cmd->scsi_done(cmd);
 	}
@@ -5104,7 +5104,7 @@  int ata_sas_queuecmd(struct scsi_cmnd *cmd, struct ata_port *ap)
 	if (likely(ata_dev_enabled(ap->link.device)))
 		rc = __ata_scsi_queuecmd(cmd, ap->link.device);
 	else {
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_BAD_TARGET);
 		cmd->scsi_done(cmd);
 	}
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 97ea52936764..007af14734ed 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -2945,7 +2945,7 @@  static int srp_abort(struct scsi_cmnd *scmnd)
 		ret = FAILED;
 	if (ret == SUCCESS) {
 		srp_free_req(ch, req, scmnd, 0);
-		scmnd->result = 0;
+		clear_scsi_result(scmnd);
 		set_host_byte(scmnd, DID_ABORT);
 		scmnd->scsi_done(scmnd);
 	}
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c
index 3db52ff655b9..0e2775c21b3b 100644
--- a/drivers/message/fusion/mptfc.c
+++ b/drivers/message/fusion/mptfc.c
@@ -649,7 +649,7 @@  mptfc_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *SCpnt)
 	VirtDevice	*vdevice = SCpnt->device->hostdata;
 
 	if (!vdevice || !vdevice->vtarget) {
-		SCpnt->result = 0;
+		clear_scsi_result(SCpnt);
 		set_host_byte(SCpnt, DID_NO_CONNECT);
 		SCpnt->scsi_done(SCpnt);
 		return 0;
@@ -665,7 +665,7 @@  mptfc_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *SCpnt)
 	/* dd_data is null until finished adding target */
 	ri = *((struct mptfc_rport_info **)rport->dd_data);
 	if (unlikely(!ri)) {
-		SCpnt->result = 0;
+		clear_scsi_result(SCpnt);
 		set_host_byte(SCpnt, DID_IMM_RETRY);
 		SCpnt->scsi_done(SCpnt);
 		return 0;
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index f0b146039faf..52d8e231aaed 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -1900,7 +1900,7 @@  mptsas_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *SCpnt)
 	VirtDevice	*vdevice = SCpnt->device->hostdata;
 
 	if (!vdevice || !vdevice->vtarget || vdevice->vtarget->deleted) {
-		SCpnt->result = 0;
+		clear_scsi_result(SCpnt);
 		set_host_byte(SCpnt, DID_NO_CONNECT);
 		SCpnt->scsi_done(SCpnt);
 		return 0;
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index cedd923fa67f..b3f81f8a8b7c 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -634,14 +634,14 @@  mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
 
 		if (!vdevice || !vdevice->vtarget ||
 		    vdevice->vtarget->deleted) {
-			sc->result = 0;
+			clear_scsi_result(sc);
 			set_host_byte(sc, DID_NO_CONNECT);
 			goto out;
 		}
 	}
 
 	sc->host_scribble = NULL;
-	sc->result = 0;
+	clear_scsi_result(sc);
 	set_host_byte(sc, DID_OK);		/* Set default reply as OK */
 	pScsiReq = (SCSIIORequest_t *) mf;
 	pScsiReply = (SCSIIOReply_t *) mr;
@@ -714,19 +714,19 @@  mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
 
 		case MPI_IOCSTATUS_SCSI_INVALID_BUS:		/* 0x0041 */
 		case MPI_IOCSTATUS_SCSI_INVALID_TARGETID:	/* 0x0042 */
-			sc->result = 0;
+			clear_scsi_result(sc);
 			set_host_byte(sc, DID_BAD_TARGET);
 			break;
 
 		case MPI_IOCSTATUS_SCSI_DEVICE_NOT_THERE:	/* 0x0043 */
 			/* Spoof to SCSI Selection Timeout! */
 			if (ioc->bus_type != FC) {
-				sc->result = 0;
+				clear_scsi_result(sc);
 				set_host_byte(sc, DID_NO_CONNECT);
 			}
 			/* else fibre, just stall until rescan event */
 			else {
-				sc->result = 0;
+				clear_scsi_result(sc);
 				set_host_byte(sc, DID_REQUEUE);
 			}
 
@@ -772,7 +772,7 @@  mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
 							vdevice->vtarget->
 								inDMD = 1;
 
-					    sc->result = 0;
+					    clear_scsi_result(sc);
 					    set_host_byte(sc,
 							  DID_TRANSPORT_DISRUPTED);
 					    break;
@@ -786,7 +786,7 @@  mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
 				 * DID_RESET to permit retry of the command,
 				 * just not an infinite number of them
 				 */
-				sc->result = 0;
+				clear_scsi_result(sc);
 				set_host_byte(sc, DID_ERROR);
 				break;
 			}
@@ -799,17 +799,17 @@  mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
 			/* Linux handles an unsolicited DID_RESET better
 			 * than an unsolicited DID_ABORT.
 			 */
-			sc->result = 0;
+			clear_scsi_result(sc);
 			set_host_byte(sc, DID_RESET);
 			break;
 
 		case MPI_IOCSTATUS_SCSI_EXT_TERMINATED:		/* 0x004C */
 			if (ioc->bus_type == FC) {
-				sc->result = 0;
+				clear_scsi_result(sc);
 				set_host_byte(sc, DID_ERROR);
 			}
 			else {
-				sc->result = 0;
+				clear_scsi_result(sc);
 				set_host_byte(sc, DID_RESET);
 			}
 			break;
@@ -817,7 +817,7 @@  mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
 		case MPI_IOCSTATUS_SCSI_RESIDUAL_MISMATCH:	/* 0x0049 */
 			scsi_set_resid(sc, scsi_bufflen(sc) - xfer_cnt);
 			if((xfer_cnt==0)||(sc->underflow > xfer_cnt)) {
-				sc->result = 0;
+				clear_scsi_result(sc);
 				set_host_byte(sc, DID_SOFT_ERROR);
 			}
 			else /* Sufficient data transfer occurred */
@@ -852,7 +852,7 @@  mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
 					    pScsiReq->CDB[0] == VERIFY_16) {
 						if (scsi_bufflen(sc) !=
 							xfer_cnt) {
-							sc->result = 0;
+							clear_scsi_result(sc);
 							set_host_byte(sc,
 								      DID_SOFT_ERROR);
 						    printk(KERN_WARNING "Errata"
@@ -869,7 +869,7 @@  mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
 					if (scsi_status == SAM_STAT_BUSY)
 						set_status_byte(sc, SAM_STAT_BUSY);
 					else {
-						sc->result = 0;
+						clear_scsi_result(sc);
 						set_host_byte(sc,
 							      DID_SOFT_ERROR);
 					}
@@ -877,12 +877,12 @@  mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
 				if (scsi_state & (MPI_SCSI_STATE_AUTOSENSE_FAILED | MPI_SCSI_STATE_NO_SCSI_STATUS)) {
 					/* What to do?
 				 	*/
-					sc->result = 0;
+					clear_scsi_result(sc);
 					set_host_byte(sc, DID_SOFT_ERROR);
 				}
 				else if (scsi_state & MPI_SCSI_STATE_TERMINATED) {
 					/*  Not real sure here either...  */
-					sc->result = 0;
+					clear_scsi_result(sc);
 					set_host_byte(sc, DID_RESET);
 				}
 			}
@@ -976,12 +976,12 @@  mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
 				/*
 				 * What to do?
 				 */
-				sc->result = 0;
+				clear_scsi_result(sc);
 				set_host_byte(sc, DID_SOFT_ERROR);
 			}
 			else if (scsi_state & MPI_SCSI_STATE_TERMINATED) {
 				/*  Not real sure here either...  */
-				sc->result = 0;
+				clear_scsi_result(sc);
 				set_host_byte(sc, DID_RESET);
 			}
 			else if (scsi_state & MPI_SCSI_STATE_QUEUE_TAG_REJECTED) {
@@ -1002,7 +1002,7 @@  mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
 			break;
 
 		case MPI_IOCSTATUS_SCSI_PROTOCOL_ERROR:		/* 0x0047 */
-			sc->result = 0;
+			clear_scsi_result(sc);
 			set_host_byte(sc, DID_SOFT_ERROR);
 			break;
 
@@ -1018,7 +1018,7 @@  mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
 			/*
 			 * What to do?
 			 */
-			sc->result = 0;
+			clear_scsi_result(sc);
 			set_host_byte(sc, DID_SOFT_ERROR);
 			break;
 
@@ -1074,7 +1074,7 @@  mptscsih_flush_running_cmds(MPT_SCSI_HOST *hd)
 		if ((unsigned char *)mf != sc->host_scribble)
 			continue;
 		scsi_dma_unmap(sc);
-		sc->result = 0;
+		clear_scsi_result(sc);
 		set_host_byte(sc, DID_RESET);
 		sc->host_scribble = NULL;
 		dtmprintk(ioc, sdev_printk(KERN_INFO, sc->device, MYIOC_s_FMT
@@ -1138,7 +1138,7 @@  mptscsih_search_running_cmds(MPT_SCSI_HOST *hd, VirtDevice *vdevice)
 			mpt_free_msg_frame(ioc, (MPT_FRAME_HDR *)mf);
 			scsi_dma_unmap(sc);
 			sc->host_scribble = NULL;
-			sc->result = 0;
+			clear_scsi_result(sc);
 			set_host_byte(sc, DID_NO_CONNECT);
 			dtmprintk(ioc, sdev_printk(KERN_INFO, sc->device,
 			   MYIOC_s_FMT "completing cmds: fw_channel %d, "
@@ -1717,7 +1717,7 @@  mptscsih_abort(struct scsi_cmnd * SCpnt)
 	/* If we can't locate our host adapter structure, return FAILED status.
 	 */
 	if ((hd = shost_priv(SCpnt->device->host)) == NULL) {
-		SCpnt->result = 0;
+		clear_scsi_result(SCpnt);
 		set_host_byte(SCpnt, DID_RESET);
 		SCpnt->scsi_done(SCpnt);
 		printk(KERN_ERR MYNAM ": task abort: "
@@ -1735,7 +1735,7 @@  mptscsih_abort(struct scsi_cmnd * SCpnt)
 		dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
 		    "task abort: device has been deleted (sc=%p)\n",
 		    ioc->name, SCpnt));
-		SCpnt->result = 0;
+		clear_scsi_result(SCpnt);
 		set_host_byte(SCpnt, DID_NO_CONNECT);
 		SCpnt->scsi_done(SCpnt);
 		retval = SUCCESS;
@@ -1748,7 +1748,7 @@  mptscsih_abort(struct scsi_cmnd * SCpnt)
 		dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
 		    "task abort: hidden raid component (sc=%p)\n",
 		    ioc->name, SCpnt));
-		SCpnt->result = 0;
+		clear_scsi_result(SCpnt);
 		set_host_byte(SCpnt, DID_RESET);
 		retval = FAILED;
 		goto out;
@@ -1760,7 +1760,7 @@  mptscsih_abort(struct scsi_cmnd * SCpnt)
 		dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
 		    "task abort: raid volume (sc=%p)\n",
 		    ioc->name, SCpnt));
-		SCpnt->result = 0;
+		clear_scsi_result(SCpnt);
 		set_host_byte(SCpnt, DID_RESET);
 		retval = FAILED;
 		goto out;
@@ -1772,7 +1772,7 @@  mptscsih_abort(struct scsi_cmnd * SCpnt)
 		/* Cmd not found in ScsiLookup.
 		 * Do OS callback.
 		 */
-		SCpnt->result = 0;
+		clear_scsi_result(SCpnt);
 		set_host_byte(SCpnt, DID_RESET);
 		dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "task abort: "
 		   "Command not in the active list! (sc=%p)\n", ioc->name,
diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c
index 73cea95eb668..f0ad277b32c0 100644
--- a/drivers/message/fusion/mptspi.c
+++ b/drivers/message/fusion/mptspi.c
@@ -786,7 +786,7 @@  mptspi_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *SCpnt)
 	MPT_ADAPTER *ioc = hd->ioc;
 
 	if (!vdevice || !vdevice->vtarget) {
-		SCpnt->result = 0;
+		clear_scsi_result(SCpnt);
 		set_host_byte(SCpnt, DID_NO_CONNECT);
 		SCpnt->scsi_done(SCpnt);
 		return 0;
@@ -794,7 +794,7 @@  mptspi_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *SCpnt)
 
 	if (SCpnt->device->channel == 1 &&
 		mptscsih_is_phys_disk(ioc, 0, SCpnt->device->id) == 0) {
-		SCpnt->result = 0;
+		clear_scsi_result(SCpnt);
 		set_host_byte(SCpnt, DID_NO_CONNECT);
 		SCpnt->scsi_done(SCpnt);
 		return 0;
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index 952f3b9639d1..6f613d26beff 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -67,7 +67,7 @@  int zfcp_scsi_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scpnt)
 	int    status, scsi_result, ret;
 
 	/* reset the status for this request */
-	scpnt->result = 0;
+	clear_scsi_result(scpnt);
 	scpnt->host_scribble = NULL;
 
 	scsi_result = fc_remote_port_chkready(rport);
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
index 7da983720550..6acf6dc7adaa 100644
--- a/drivers/scsi/3w-9xxx.c
+++ b/drivers/scsi/3w-9xxx.c
@@ -1328,7 +1328,7 @@  static irqreturn_t twa_interrupt(int irq, void *dev_instance)
 				twa_scsiop_execute_scsi_complete(tw_dev, request_id);
 				/* If no error command was a success */
 				if (error == 0) {
-					cmd->result = 0;
+					clear_scsi_result(cmd);
 					set_host_byte(cmd, DID_OK);
 				}
 
@@ -1589,7 +1589,7 @@  static int twa_reset_device_extension(TW_Device_Extension *tw_dev)
 			if (tw_dev->srb[i]) {
 				struct scsi_cmnd *cmd = tw_dev->srb[i];
 
-				cmd->result = 0;
+				clear_scsi_result(cmd);
 				set_host_byte(cmd, DID_RESET);
 				if (twa_command_mapped(cmd))
 					scsi_dma_unmap(cmd);
@@ -1757,7 +1757,7 @@  static int twa_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_
 
 	/* Check if this FW supports luns */
 	if ((SCpnt->device->lun != 0) && (tw_dev->tw_compat_info.working_srl < TW_FW_SRL_LUNS_SUPPORTED)) {
-		SCpnt->result = 0;
+		clear_scsi_result(SCpnt);
 		set_host_byte(SCpnt, DID_BAD_TARGET);
 		done(SCpnt);
 		retval = 0;
@@ -1781,7 +1781,7 @@  static int twa_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_
 		twa_free_request_id(tw_dev, request_id);
 		break;
 	case 1:
-		SCpnt->result = 0;
+		clear_scsi_result(SCpnt);
 		set_host_byte(SCpnt, DID_ERROR);
 		if (twa_command_mapped(SCpnt))
 			scsi_dma_unmap(SCpnt);
diff --git a/drivers/scsi/3w-sas.c b/drivers/scsi/3w-sas.c
index 6217d1951ea9..2b433b2f4359 100644
--- a/drivers/scsi/3w-sas.c
+++ b/drivers/scsi/3w-sas.c
@@ -1209,7 +1209,7 @@  static irqreturn_t twl_interrupt(int irq, void *dev_instance)
 			cmd = tw_dev->srb[request_id];
 
 			if (!error) {
-				cmd->result = 0;
+				clear_scsi_result(cmd);
 				set_host_byte(cmd, DID_OK);
 			}
 			
@@ -1372,7 +1372,7 @@  static int twl_reset_device_extension(TW_Device_Extension *tw_dev, int ioctl_res
 			struct scsi_cmnd *cmd = tw_dev->srb[i];
 
 			if (cmd) {
-				cmd->result = 0;
+				clear_scsi_result(cmd);
 				set_host_byte(cmd, DID_RESET);
 				scsi_dma_unmap(cmd);
 				cmd->scsi_done(cmd);
@@ -1483,7 +1483,7 @@  static int twl_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_
 	if (retval) {
 		tw_dev->state[request_id] = TW_S_COMPLETED;
 		twl_free_request_id(tw_dev, request_id);
-		SCpnt->result = 0;
+		clear_scsi_result(SCpnt);
 		set_host_byte(SCpnt, DID_ERROR);
 		done(SCpnt);
 		retval = 0;
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c
index ea259daf3089..5b91498a740f 100644
--- a/drivers/scsi/3w-xxxx.c
+++ b/drivers/scsi/3w-xxxx.c
@@ -1152,7 +1152,7 @@  static int tw_setfeature(TW_Device_Extension *tw_dev, int parm, int param_size,
 		printk(KERN_WARNING "3w-xxxx: tw_setfeature(): Bad alignment physical address.\n");
 		tw_dev->state[request_id] = TW_S_COMPLETED;
 		tw_state_request_finish(tw_dev, request_id);
-		tw_dev->srb[request_id]->result = 0;
+		clear_scsi_result(tw_dev->srb[request_id]);
 		set_host_byte(tw_dev->srb[request_id], DID_OK);
 		tw_dev->srb[request_id]->scsi_done(tw_dev->srb[request_id]);
 	}
@@ -1297,7 +1297,7 @@  static int tw_reset_device_extension(TW_Device_Extension *tw_dev)
 		    (tw_dev->state[i] != TW_S_COMPLETED)) {
 			srb = tw_dev->srb[i];
 			if (srb != NULL) {
-				srb->result = 0;
+				clear_scsi_result(srb);
 				set_host_byte(srb, DID_RESET);
 				scsi_dma_unmap(srb);
 				srb->scsi_done(srb);
@@ -1480,7 +1480,7 @@  static int tw_scsiop_inquiry_complete(TW_Device_Extension *tw_dev, int request_i
 		tw_dev->is_unit_present[tw_dev->srb[request_id]->device->id] = 1;
 	} else {
 		tw_dev->is_unit_present[tw_dev->srb[request_id]->device->id] = 0;
-		tw_dev->srb[request_id]->result = 0;
+		clear_scsi_result(tw_dev->srb[request_id]);
 		set_host_byte(tw_dev->srb[request_id], DID_BAD_TARGET);
 		return TW_ISR_DONT_RESULT;
 	}
@@ -1502,7 +1502,7 @@  static int tw_scsiop_mode_sense(TW_Device_Extension *tw_dev, int request_id)
 	if (tw_dev->srb[request_id]->cmnd[2] != 0x8) {
 		tw_dev->state[request_id] = TW_S_COMPLETED;
 		tw_state_request_finish(tw_dev, request_id);
-		tw_dev->srb[request_id]->result = 0;
+		clear_scsi_result(tw_dev->srb[request_id]);
 		set_host_byte(tw_dev->srb[request_id], DID_OK);
 		tw_dev->srb[request_id]->scsi_done(tw_dev->srb[request_id]);
 		return 0;
@@ -1794,7 +1794,7 @@  static int tw_scsiop_request_sense(TW_Device_Extension *tw_dev, int request_id)
 	tw_state_request_finish(tw_dev, request_id);
 
 	/* If we got a request_sense, we probably want a reset, return error */
-	tw_dev->srb[request_id]->result = 0;
+	clear_scsi_result(tw_dev->srb[request_id]);
 	set_host_byte(tw_dev->srb[request_id], DID_ERROR);
 	tw_dev->srb[request_id]->scsi_done(tw_dev->srb[request_id]);
 
@@ -1910,7 +1910,7 @@  static int tw_scsiop_test_unit_ready_complete(TW_Device_Extension *tw_dev, int r
 		tw_dev->is_unit_present[tw_dev->srb[request_id]->device->id] = 1;
 	} else {
 		tw_dev->is_unit_present[tw_dev->srb[request_id]->device->id] = 0;
-		tw_dev->srb[request_id]->result = 0;
+		clear_scsi_result(tw_dev->srb[request_id]);
 		set_host_byte(tw_dev->srb[request_id], DID_BAD_TARGET);
 		return TW_ISR_DONT_RESULT;
 	}
@@ -1987,7 +1987,7 @@  static int tw_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_c
 	if (retval) {
 		tw_dev->state[request_id] = TW_S_COMPLETED;
 		tw_state_request_finish(tw_dev, request_id);
-		SCpnt->result = 0;
+		clear_scsi_result(SCpnt);
 		set_host_byte(SCpnt, DID_ERROR);
 		done(SCpnt);
 		retval = 0;
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index 11323097a43d..7534d2404050 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -1565,7 +1565,7 @@  NCR_700_intr(int irq, void *dev_id)
 				 * command again otherwise we'll
 				 * deadlock on the
 				 * hostdata->state_lock */
-				SCp->result = 0;
+				clear_scsi_result(SCp);
 				set_host_byte(SCp, DID_RESET);
 				SCp->scsi_done(SCp);
 			}
diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c
index 2f4f05f312e1..3c0db9dbd50d 100644
--- a/drivers/scsi/BusLogic.c
+++ b/drivers/scsi/BusLogic.c
@@ -2795,7 +2795,7 @@  static void blogic_process_ccbs(struct blogic_adapter *adapter)
 					command = ccb->command;
 					blogic_dealloc_ccb(ccb, 1);
 					adapter->active_cmds[tgt_id]--;
-					command->result = 0;
+					clear_scsi_result(command);
 					set_host_byte(command, DID_RESET);
 					command->scsi_done(command);
 				}
@@ -2817,14 +2817,14 @@  static void blogic_process_ccbs(struct blogic_adapter *adapter)
 				    .cmds_complete++;
 				adapter->tgt_flags[ccb->tgt_id]
 				    .cmd_good = true;
-				command->result = 0;
+				clear_scsi_result(command);
 				set_host_byte(command, DID_OK);
 				break;
 			case BLOGIC_CMD_ABORT_BY_HOST:
 				blogic_warn("CCB #%ld to Target %d Aborted\n",
 					adapter, ccb->serial, ccb->tgt_id);
 				blogic_inc_count(&adapter->tgt_stats[ccb->tgt_id].aborts_done);
-				command->result = 0;
+				clear_scsi_result(command);
 				set_host_byte(command, DID_ABORT);
 				break;
 			case BLOGIC_CMD_COMPLETE_ERROR:
@@ -3048,7 +3048,7 @@  static int blogic_qcmd_lck(struct scsi_cmnd *command,
 	   occurred.
 	 */
 	if (cdb[0] == REQUEST_SENSE && command->sense_buffer[0] != 0) {
-		command->result = 0;
+		clear_scsi_result(command);
 		set_host_byte(command, DID_OK);
 		comp_cb(command);
 		return 0;
@@ -3067,7 +3067,7 @@  static int blogic_qcmd_lck(struct scsi_cmnd *command,
 		spin_lock_irq(adapter->scsi_host->host_lock);
 		ccb = blogic_alloc_ccb(adapter);
 		if (ccb == NULL) {
-			command->result = 0;
+			clear_scsi_result(command);
 			set_host_byte(command, DID_ERROR);
 			comp_cb(command);
 			return 0;
@@ -3219,7 +3219,7 @@  static int blogic_qcmd_lck(struct scsi_cmnd *command,
 						ccb)) {
 				blogic_warn("Still unable to write Outgoing Mailbox - " "Host Adapter Dead?\n", adapter);
 				blogic_dealloc_ccb(ccb, 1);
-				command->result = 0;
+				clear_scsi_result(command);
 				set_host_byte(command, DID_ERROR);
 				command->scsi_done(command);
 			}
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index a0b79899bce3..5c94425486f8 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -548,14 +548,14 @@  static int NCR5380_queue_command(struct Scsi_Host *instance,
 	case WRITE_6:
 	case WRITE_10:
 		shost_printk(KERN_DEBUG, instance, "WRITE attempted with NDEBUG_NO_WRITE set\n");
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_ERROR);
 		cmd->scsi_done(cmd);
 		return 0;
 	}
 #endif /* (NDEBUG & NDEBUG_NO_WRITE) */
 
-	cmd->result = 0;
+	clear_scsi_result(cmd);
 
 	if (!NCR5380_acquire_dma_irq(instance))
 		return SCSI_MLQUEUE_HOST_BUSY;
@@ -1119,7 +1119,7 @@  static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance,
 		NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
 		/* Can't touch cmd if it has been reclaimed by the scsi ML */
 		if (hostdata->selecting) {
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_BAD_TARGET);
 			complete_cmd(instance, cmd);
 			dsprintk(NDEBUG_SELECTION, instance, "target did not respond within 250ms\n");
@@ -1170,7 +1170,7 @@  static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance,
 	NCR5380_transfer_pio(instance, &phase, &len, &data);
 	if (len) {
 		NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_ERROR);
 		complete_cmd(instance, cmd);
 		dsprintk(NDEBUG_SELECTION, instance, "IDENTIFY message transfer failed\n");
@@ -1711,7 +1711,7 @@  static void NCR5380_information_transfer(struct Scsi_Host *instance)
 				shost_printk(KERN_DEBUG, instance, "NDEBUG_NO_DATAOUT set, attempted DATAOUT aborted\n");
 				sink = 1;
 				do_abort(instance);
-				cmd->result = 0;
+				clear_scsi_result(cmd);
 				set_host_byte(cmd, DID_ERROR);
 				complete_cmd(instance, cmd);
 				hostdata->connected = NULL;
@@ -1761,7 +1761,7 @@  static void NCR5380_information_transfer(struct Scsi_Host *instance)
 						cmd->device->borken = 1;
 						sink = 1;
 						do_abort(instance);
-						cmd->result = 0;
+						clear_scsi_result(cmd);
 						set_host_byte(cmd, DID_ERROR);
 						/* XXX - need to source or sink data here, as appropriate */
 					}
@@ -1956,7 +1956,7 @@  static void NCR5380_information_transfer(struct Scsi_Host *instance)
 				NCR5380_transfer_pio(instance, &phase, &len, &data);
 				if (msgout == ABORT) {
 					hostdata->connected = NULL;
-					cmd->result = 0;
+					clear_scsi_result(cmd);
 					set_host_byte(cmd, DID_ERROR);
 					complete_cmd(instance, cmd);
 					maybe_release_dma_irq(instance);
@@ -2234,7 +2234,7 @@  static int NCR5380_abort(struct scsi_cmnd *cmd)
 	if (list_del_cmd(&hostdata->unissued, cmd)) {
 		dsprintk(NDEBUG_ABORT, instance,
 		         "abort: removed %p from issue queue\n", cmd);
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_ABORT);
 		cmd->scsi_done(cmd); /* No tag or busy flag to worry about */
 		goto out;
@@ -2244,7 +2244,7 @@  static int NCR5380_abort(struct scsi_cmnd *cmd)
 		dsprintk(NDEBUG_ABORT, instance,
 		         "abort: cmd %p == selecting\n", cmd);
 		hostdata->selecting = NULL;
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_ABORT);
 		complete_cmd(instance, cmd);
 		goto out;
@@ -2335,7 +2335,7 @@  static int NCR5380_host_reset(struct scsi_cmnd *cmd)
 	 */
 
 	if (list_del_cmd(&hostdata->unissued, cmd)) {
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_RESET);
 		cmd->scsi_done(cmd);
 	}
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 3c71393018b7..3192eec0e69f 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -627,7 +627,7 @@  static int aac_probe_container_callback2(struct scsi_cmnd * scsicmd)
 	if ((fsa_dev_ptr[scmd_id(scsicmd)].valid & 1))
 		return aac_scsi_cmd(scsicmd);
 
-	scsicmd->result = 0;
+	clear_scsi_result(scsicmd);
 	set_host_byte(scsicmd, DID_NO_CONNECT);
 	scsicmd->scsi_done(scsicmd);
 	return 0;
@@ -2879,7 +2879,7 @@  int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
 		if (scmd_channel(scsicmd) == CONTAINER_CHANNEL) {
 			if((cid >= dev->maximum_num_containers) ||
 					(scsicmd->device->lun != 0)) {
-				scsicmd->result = 0;
+				clear_scsi_result(scsicmd);
 				set_host_byte(scsicmd, DID_NO_CONNECT);
 				goto scsi_done_ret;
 			}
@@ -2923,7 +2923,7 @@  int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
 					return -1;
 				return aac_send_srb_fib(scsicmd);
 			} else {
-				scsicmd->result = 0;
+				clear_scsi_result(scsicmd);
 				set_host_byte(scsicmd, DID_NO_CONNECT);
 				goto scsi_done_ret;
 			}
@@ -3852,7 +3852,7 @@  static int aac_send_srb_fib(struct scsi_cmnd* scsicmd)
 	dev = (struct aac_dev *)scsicmd->device->host->hostdata;
 	if (scmd_id(scsicmd) >= dev->maximum_num_physicals ||
 			scsicmd->device->lun > 7) {
-		scsicmd->result = 0;
+		clear_scsi_result(scsicmd);
 		set_host_byte(scsicmd, DID_NO_CONNECT);
 		scsicmd->scsi_done(scsicmd);
 		return 0;
@@ -3895,7 +3895,7 @@  static int aac_send_hba_fib(struct scsi_cmnd *scsicmd)
 	dev = shost_priv(scsicmd->device->host);
 	if (scmd_id(scsicmd) >= dev->maximum_num_physicals ||
 			scsicmd->device->lun > AAC_MAX_LUN - 1) {
-		scsicmd->result = 0;
+		clear_scsi_result(scsicmd);
 		set_host_byte(scsicmd, DID_NO_CONNECT);
 		scsicmd->scsi_done(scsicmd);
 		return 0;
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 4e2619177254..ac3f897a8ca0 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -1974,11 +1974,11 @@  static void aac_flush_ios(struct aac_dev *aac)
 			scsi_dma_unmap(cmd);
 
 			if (aac->handle_pci_error) {
-				cmd->result = 0;
+				clear_scsi_result(cmd);
 				set_host_byte(cmd, DID_NO_CONNECT);
 			}
 			else {
-				cmd->result = 0;
+				clear_scsi_result(cmd);
 				set_host_byte(cmd, DID_RESET);
 			}
 
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index 2bb709df4bb9..c2bb77c4fad4 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -5996,7 +5996,7 @@  static void adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp)
 	switch (scsiqp->done_status) {
 	case QD_NO_ERROR:
 		ASC_DBG(2, "QD_NO_ERROR\n");
-		scp->result = 0;
+		clear_scsi_result(scp);
 
 		/*
 		 * Check for an underrun condition.
@@ -6763,7 +6763,7 @@  static void asc_isr_callback(ASC_DVC_VAR *asc_dvc_varp, ASC_QDONE_INFO *qdonep)
 	switch (qdonep->d3.done_stat) {
 	case QD_NO_ERROR:
 		ASC_DBG(2, "QD_NO_ERROR\n");
-		scp->result = 0;
+		clear_scsi_result(scp);
 
 		/*
 		 * Check for an underrun condition.
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index 734a31b61934..1401f772a5ca 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -2266,7 +2266,7 @@  static void rsti_run(struct Scsi_Host *shpnt)
 			kfree(ptr->host_scribble);
 			ptr->host_scribble=NULL;
 
-			ptr->result = 0;
+			clear_scsi_result(ptr);
 			set_host_byte(ptr, DID_RESET);
 			ptr->scsi_done(ptr);
 		}
diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c
index 124217927c4a..0e37927294fe 100644
--- a/drivers/scsi/aha1542.c
+++ b/drivers/scsi/aha1542.c
@@ -382,7 +382,7 @@  static int aha1542_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *cmd)
 
 	if (*cmd->cmnd == REQUEST_SENSE) {
 		/* Don't do the command - we have the sense data already */
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		cmd->scsi_done(cmd);
 		return 0;
 	}
diff --git a/drivers/scsi/aha1740.c b/drivers/scsi/aha1740.c
index 786bf7f32c64..850447bcae99 100644
--- a/drivers/scsi/aha1740.c
+++ b/drivers/scsi/aha1740.c
@@ -325,7 +325,7 @@  static int aha1740_queuecommand_lck(struct scsi_cmnd * SCpnt,
 	DEB(int i);
 
 	if(*cmd == REQUEST_SENSE) {
-		SCpnt->result = 0;
+		clear_scsi_result(SCpnt);
 		done(SCpnt); 
 		return 0;
 	}
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index 616ab8a2844d..f4fc640df1fa 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -582,7 +582,7 @@  ahd_linux_queue_lck(struct scsi_cmnd * cmd, void (*scsi_done) (struct scsi_cmnd
 	ahd = *(struct ahd_softc **)cmd->device->host->hostdata;
 
 	cmd->scsi_done = scsi_done;
-	cmd->result = 0;
+	clear_scsi_result(cmd);
 	set_host_byte(cmd, CAM_REQ_INPROG);
 	rtn = ahd_linux_run_command(ahd, dev, cmd);
 
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index 545e9264fda9..04e9f59cfd1f 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -530,7 +530,7 @@  ahc_linux_queue_lck(struct scsi_cmnd * cmd, void (*scsi_done) (struct scsi_cmnd
 	ahc_lock(ahc, &flags);
 	if (ahc->platform_data->qfrozen == 0) {
 		cmd->scsi_done = scsi_done;
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, CAM_REQ_INPROG);
 		rtn = ahc_linux_run_command(ahc, dev, cmd);
 	}
diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
index bea71f085679..3656c5e5ba0a 100644
--- a/drivers/scsi/arcmsr/arcmsr_hba.c
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c
@@ -1265,14 +1265,14 @@  static void arcmsr_report_ccb_state(struct AdapterControlBlock *acb,
 	if (!error) {
 		if (acb->devstate[id][lun] == ARECA_RAID_GONE)
 			acb->devstate[id][lun] = ARECA_RAID_GOOD;
-		ccb->pcmd->result = 0;
+		clear_scsi_result(ccb->pcmd);
 		set_host_byte(ccb->pcmd, DID_OK);
 		arcmsr_ccb_complete(ccb);
 	}else{
 		switch (ccb->arcmsr_cdb.DeviceStatus) {
 		case ARCMSR_DEV_SELECT_TIMEOUT: {
 			acb->devstate[id][lun] = ARECA_RAID_GONE;
-			ccb->pcmd->result = 0;
+			clear_scsi_result(ccb->pcmd);
 			set_host_byte(ccb->pcmd, DID_NO_CONNECT);
 			arcmsr_ccb_complete(ccb);
 			}
@@ -1282,7 +1282,7 @@  static void arcmsr_report_ccb_state(struct AdapterControlBlock *acb,
 
 		case ARCMSR_DEV_INIT_FAIL: {
 			acb->devstate[id][lun] = ARECA_RAID_GONE;
-			ccb->pcmd->result = 0;
+			clear_scsi_result(ccb->pcmd);
 			set_host_byte(ccb->pcmd, DID_BAD_TARGET);
 			arcmsr_ccb_complete(ccb);
 			}
@@ -1304,7 +1304,7 @@  static void arcmsr_report_ccb_state(struct AdapterControlBlock *acb,
 				, lun
 				, ccb->arcmsr_cdb.DeviceStatus);
 				acb->devstate[id][lun] = ARECA_RAID_GONE;
-				ccb->pcmd->result = 0;
+				clear_scsi_result(ccb->pcmd);
 				set_host_byte(ccb->pcmd, DID_NO_CONNECT);
 				arcmsr_ccb_complete(ccb);
 			break;
@@ -1461,7 +1461,7 @@  static void arcmsr_remove_scsi_devices(struct AdapterControlBlock *acb)
 	for (i = 0; i < acb->maxFreeCCB; i++) {
 		ccb = acb->pccb_pool[i];
 		if (ccb->startdone == ARCMSR_CCB_START) {
-			ccb->pcmd->result = 0;
+			clear_scsi_result(ccb->pcmd);
 			set_host_byte(ccb->pcmd, DID_NO_CONNECT);
 			arcmsr_pci_unmap_dma(ccb);
 			ccb->pcmd->scsi_done(ccb->pcmd);
@@ -1553,7 +1553,7 @@  static void arcmsr_remove(struct pci_dev *pdev)
 			struct CommandControlBlock *ccb = acb->pccb_pool[i];
 			if (ccb->startdone == ARCMSR_CCB_START) {
 				ccb->startdone = ARCMSR_CCB_ABORTED;
-				ccb->pcmd->result = 0;
+				clear_scsi_result(ccb->pcmd);
 				set_host_byte(ccb->pcmd, DID_ABORT);
 				arcmsr_ccb_complete(ccb);
 			}
@@ -2960,7 +2960,7 @@  static void arcmsr_handle_virtual_command(struct AdapterControlBlock *acb,
 		struct scatterlist *sg;
 
 		if (cmd->device->lun) {
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_TIME_OUT);
 			cmd->scsi_done(cmd);
 			return;
@@ -2992,7 +2992,7 @@  static void arcmsr_handle_virtual_command(struct AdapterControlBlock *acb,
 	case WRITE_BUFFER:
 	case READ_BUFFER: {
 		if (arcmsr_iop_message_xfer(acb, cmd)) {
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_ERROR);
 		}
 		cmd->scsi_done(cmd);
@@ -3012,14 +3012,14 @@  static int arcmsr_queue_command_lck(struct scsi_cmnd *cmd,
 	int target = cmd->device->id;
 
 	if (acb->acb_flags & ACB_F_ADAPTER_REMOVED) {
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_NO_CONNECT);
 		cmd->scsi_done(cmd);
 		return 0;
 	}
 	cmd->scsi_done = done;
 	cmd->host_scribble = NULL;
-	cmd->result = 0;
+	clear_scsi_result(cmd);
 	if (target == 16) {
 		/* virtual device for iop message transfer */
 		arcmsr_handle_virtual_command(acb, cmd);
@@ -3260,7 +3260,7 @@  static int arcmsr_hbaA_polling_ccbdone(struct AdapterControlBlock *acb,
 					, ccb->pcmd->device->id
 					, (u32)ccb->pcmd->device->lun
 					, ccb);
-				ccb->pcmd->result = 0;
+				clear_scsi_result(ccb->pcmd);
 				set_host_byte(ccb->pcmd, DID_ABORT);
 				arcmsr_ccb_complete(ccb);
 				continue;
@@ -3326,7 +3326,7 @@  static int arcmsr_hbaB_polling_ccbdone(struct AdapterControlBlock *acb,
 					,ccb->pcmd->device->id
 					,(u32)ccb->pcmd->device->lun
 					,ccb);
-				ccb->pcmd->result = 0;
+				clear_scsi_result(ccb->pcmd);
 				set_host_byte(ccb->pcmd, DID_ABORT);
 				arcmsr_ccb_complete(ccb);
 				continue;
@@ -3385,7 +3385,7 @@  static int arcmsr_hbaC_polling_ccbdone(struct AdapterControlBlock *acb,
 					, pCCB->pcmd->device->id
 					, (u32)pCCB->pcmd->device->lun
 					, pCCB);
-					pCCB->pcmd->result = 0;
+					clear_scsi_result(pCCB->pcmd);
 					set_host_byte(pCCB->pcmd, DID_ABORT);
 					arcmsr_ccb_complete(pCCB);
 				continue;
@@ -3459,7 +3459,7 @@  static int arcmsr_hbaD_polling_ccbdone(struct AdapterControlBlock *acb,
 					, pCCB->pcmd->device->id
 					, (u32)pCCB->pcmd->device->lun
 					, pCCB);
-				pCCB->pcmd->result = 0;
+				clear_scsi_result(pCCB->pcmd);
 				set_host_byte(pCCB->pcmd, DID_ABORT);
 				arcmsr_ccb_complete(pCCB);
 				continue;
@@ -3528,7 +3528,7 @@  static int arcmsr_hbaE_polling_ccbdone(struct AdapterControlBlock *acb,
 					, pCCB->pcmd->device->id
 					, (u32)pCCB->pcmd->device->lun
 					, pCCB);
-				pCCB->pcmd->result = 0;
+				clear_scsi_result(pCCB->pcmd);
 				set_host_byte(pCCB->pcmd, DID_ABORT);
 				arcmsr_ccb_complete(pCCB);
 				continue;
diff --git a/drivers/scsi/arm/acornscsi.c b/drivers/scsi/arm/acornscsi.c
index 9b91e6b7ef14..1645c4653230 100644
--- a/drivers/scsi/arm/acornscsi.c
+++ b/drivers/scsi/arm/acornscsi.c
@@ -2484,7 +2484,7 @@  static int acornscsi_queuecmd_lck(struct scsi_cmnd *SCpnt,
     if (acornscsi_cmdtype(SCpnt->cmnd[0]) == CMD_WRITE && (NO_WRITE & (1 << SCpnt->device->id))) {
 	printk(KERN_CRIT "scsi%d.%c: WRITE attempted with NO_WRITE flag set\n",
 	    host->host->host_no, '0' + SCpnt->device->id);
-	SCpnt->result = 0;
+	clear_scsi_result(SCpnt);
 	set_host_byte(SCpnt, DID_NO_CONNECT);
 	done(SCpnt);
 	return 0;
@@ -2493,7 +2493,7 @@  static int acornscsi_queuecmd_lck(struct scsi_cmnd *SCpnt,
 
     SCpnt->scsi_done = done;
     SCpnt->host_scribble = NULL;
-    SCpnt->result = 0;
+    clear_scsi_result(SCpnt);
     SCpnt->tag = 0;
     SCpnt->SCp.phase = (int)acornscsi_datadirection(SCpnt->cmnd[0]);
     SCpnt->SCp.sent_command = 0;
@@ -2507,7 +2507,7 @@  static int acornscsi_queuecmd_lck(struct scsi_cmnd *SCpnt,
 	unsigned long flags;
 
 	if (!queue_add_cmd_ordered(&host->queues.issue, SCpnt)) {
-	    SCpnt->result = 0;
+	    clear_scsi_result(SCpnt);
 	    set_host_byte(SCpnt, DID_ERROR);
 	    done(SCpnt);
 	    return 0;
diff --git a/drivers/scsi/arm/fas216.c b/drivers/scsi/arm/fas216.c
index dd1d8c903e31..ad681b97d43d 100644
--- a/drivers/scsi/arm/fas216.c
+++ b/drivers/scsi/arm/fas216.c
@@ -2211,7 +2211,7 @@  static int fas216_queue_command_lck(struct scsi_cmnd *SCpnt,
 
 	SCpnt->scsi_done = done;
 	SCpnt->host_scribble = (void *)fas216_std_done;
-	SCpnt->result = 0;
+	clear_scsi_result(SCpnt);
 
 	init_SCp(SCpnt);
 
diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c
index 56a85ddbfca0..a1361b662ef9 100644
--- a/drivers/scsi/atp870u.c
+++ b/drivers/scsi/atp870u.c
@@ -592,7 +592,7 @@  static int atp870u_queuecommand_lck(struct scsi_cmnd *req_p,
 	req_p->sense_buffer[0]=0;
 	scsi_set_resid(req_p, 0);
 	if (scmd_channel(req_p) > 1) {
-		req_p->result = 0;
+		clear_scsi_result(req_p);
 		set_host_byte(req_p, DID_BAD_TARGET);
 		done(req_p);
 #ifdef ED_DBGP		
@@ -614,7 +614,7 @@  static int atp870u_queuecommand_lck(struct scsi_cmnd *req_p,
 	 */
 
 	if ((m & dev->active_id[c]) == 0) {
-		req_p->result = 0;
+		clear_scsi_result(req_p);
 		set_host_byte(req_p, DID_BAD_TARGET);
 		done(req_p);
 		return 0;
@@ -626,7 +626,7 @@  static int atp870u_queuecommand_lck(struct scsi_cmnd *req_p,
 #ifdef ED_DBGP		
 		printk( "atp870u_queuecommand: done can't be NULL\n");
 #endif		
-		req_p->result = 0;
+		clear_scsi_result(req_p);
 		done(req_p);
 		return 0;
 	}
@@ -650,7 +650,7 @@  static int atp870u_queuecommand_lck(struct scsi_cmnd *req_p,
 		printk("atp870u_queuecommand : dev->quhd[c] == dev->quend[c]\n");
 #endif		
 		dev->quend[c]--;
-		req_p->result = 0;
+		clear_scsi_result(req_p);
 		set_host_byte(req_p, DID_BUS_BUSY);
 		done(req_p);	
 		return 0;
diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c
index 8879a1835f30..5d9d97619043 100644
--- a/drivers/scsi/bfa/bfad_im.c
+++ b/drivers/scsi/bfa/bfad_im.c
@@ -1235,11 +1235,11 @@  bfad_im_queuecommand_lck(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd
 
 	if (bfad->bfad_flags & BFAD_EEH_BUSY) {
 		if (bfad->bfad_flags & BFAD_EEH_PCI_CHANNEL_IO_PERM_FAILURE) {
-			cmnd->result = 0;
+			clear_scsi_result(cmnd);
 			set_host_byte(cmnd, DID_NO_CONNECT);
 		}
 		else {
-			cmnd->result = 0;
+			clear_scsi_result(cmnd);
 			set_host_byte(cmnd, DID_REQUEUE);
 		}
 		done(cmnd);
diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c
index 21b5a901c8f3..e2d896409eb1 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_io.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_io.c
@@ -198,7 +198,7 @@  static void bnx2fc_scsi_done(struct bnx2fc_cmd *io_req, int err_code)
 		return;
 	}
 
-	sc_cmd->result = 0;
+	clear_scsi_result(sc_cmd);
 	set_host_byte(sc_cmd, err_code);
 
 	BNX2FC_IO_DBG(io_req, "sc=%p, result=0x%x, retries=%d, allowed=%d\n",
@@ -1546,7 +1546,7 @@  void bnx2fc_process_tm_compl(struct bnx2fc_cmd *io_req,
 	case FC_GOOD:
 		if (io_req->cdb_status == 0) {
 			/* Good IO completion */
-			sc_cmd->result = 0;
+			clear_scsi_result(sc_cmd);
 			set_host_byte(sc_cmd, DID_OK);
 		} else {
 			/* Transport status is good, SCSI status not good */
@@ -1943,7 +1943,7 @@  void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req,
 	case FC_GOOD:
 		if (io_req->cdb_status == 0) {
 			/* Good IO completion */
-			sc_cmd->result = 0;
+			clear_scsi_result(sc_cmd);
 			set_host_byte(sc_cmd, DID_OK);
 		} else {
 			/* Transport status is good, SCSI status not good */
diff --git a/drivers/scsi/csiostor/csio_scsi.c b/drivers/scsi/csiostor/csio_scsi.c
index d1b5cb997134..5c923e9aec8c 100644
--- a/drivers/scsi/csiostor/csio_scsi.c
+++ b/drivers/scsi/csiostor/csio_scsi.c
@@ -1799,7 +1799,7 @@  csio_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmnd)
 	}
 
 	if (unlikely(!csio_is_hw_ready(hw))) {
-		cmnd->result = 0;
+		clear_scsi_result(cmnd);
 		set_host_byte(cmnd, DID_REQUEUE);
 		CSIO_INC_STATS(scsim, n_hw_nr_error);
 		goto err_done;
@@ -1982,7 +1982,7 @@  csio_eh_abort_handler(struct scsi_cmnd *cmnd)
 		csio_scsi_cmnd(ioreq) = NULL;
 		spin_unlock_irq(&hw->lock);
 
-		cmnd->result = 0;
+		clear_scsi_result(cmnd);
 		set_host_byte(cmnd, DID_ERROR);
 		cmnd->scsi_done(cmnd);
 
diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c
index 2e10bf73e104..33b5fc881b6c 100644
--- a/drivers/scsi/cxlflash/main.c
+++ b/drivers/scsi/cxlflash/main.c
@@ -70,7 +70,7 @@  static void process_cmd_err(struct afu_cmd *cmd, struct scsi_cmnd *scp)
 	if (ioasa->rc.flags & SISL_RC_FLAGS_OVERRUN) {
 		dev_dbg(dev, "%s: cmd underrun cmd = %p scp = %p\n",
 			__func__, cmd, scp);
-		scp->result = 0;
+		clear_scsi_result(scp);
 		set_host_byte(scp, DID_ERROR);
 	}
 
@@ -98,7 +98,7 @@  static void process_cmd_err(struct afu_cmd *cmd, struct scsi_cmnd *scp)
 		/* We have an FC status */
 		switch (ioasa->rc.fc_rc) {
 		case SISL_FC_RC_LINKDOWN:
-			scp->result = 0;
+			clear_scsi_result(scp);
 			set_host_byte(scp, DID_REQUEUE);
 			break;
 		case SISL_FC_RC_RESID:
@@ -109,7 +109,7 @@  static void process_cmd_err(struct afu_cmd *cmd, struct scsi_cmnd *scp)
 				 * If not then we must handle it here.
 				 * This is probably an AFU bug.
 				 */
-				scp->result = 0;
+				clear_scsi_result(scp);
 				set_host_byte(scp, DID_ERROR);
 			}
 			break;
@@ -123,7 +123,7 @@  static void process_cmd_err(struct afu_cmd *cmd, struct scsi_cmnd *scp)
 		case SISL_FC_RC_WRABORTPEND:
 		case SISL_FC_RC_NOEXP:
 		case SISL_FC_RC_INUSE:
-			scp->result = 0;
+			clear_scsi_result(scp);
 			set_host_byte(scp, DID_ERROR);
 			break;
 		}
@@ -133,29 +133,29 @@  static void process_cmd_err(struct afu_cmd *cmd, struct scsi_cmnd *scp)
 		/* We have an AFU error */
 		switch (ioasa->rc.afu_rc) {
 		case SISL_AFU_RC_NO_CHANNELS:
-			scp->result = 0;
+			clear_scsi_result(scp);
 			set_host_byte(scp, DID_NO_CONNECT);
 			break;
 		case SISL_AFU_RC_DATA_DMA_ERR:
 			switch (ioasa->afu_extra) {
 			case SISL_AFU_DMA_ERR_PAGE_IN:
 				/* Retry */
-				scp->result = 0;
+				clear_scsi_result(scp);
 				set_host_byte(scp, DID_IMM_RETRY);
 				break;
 			case SISL_AFU_DMA_ERR_INVALID_EA:
 			default:
-				scp->result = 0;
+				clear_scsi_result(scp);
 				set_host_byte(scp, DID_ERROR);
 			}
 			break;
 		case SISL_AFU_RC_OUT_OF_DATA_BUFS:
 			/* Retry */
-			scp->result = 0;
+			clear_scsi_result(scp);
 			set_host_byte(scp, DID_ALLOC_FAILURE);
 			break;
 		default:
-			scp->result = 0;
+			clear_scsi_result(scp);
 			set_host_byte(scp, DID_ERROR);
 		}
 	}
@@ -188,7 +188,7 @@  static void cmd_complete(struct afu_cmd *cmd)
 		if (unlikely(cmd->sa.ioasc))
 			process_cmd_err(cmd, scp);
 		else {
-			scp->result = 0;
+			clear_scsi_result(scp);
 			set_host_byte(scp, DID_OK);
 		}
 
@@ -227,7 +227,7 @@  static void flush_pending_cmds(struct hwq *hwq)
 
 		if (cmd->scp) {
 			scp = cmd->scp;
-			scp->result = 0;
+			clear_scsi_result(scp);
 			set_host_byte(scp, DID_IMM_RETRY);
 			scp->scsi_done(scp);
 		} else {
@@ -616,7 +616,7 @@  static int cxlflash_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scp)
 		goto out;
 	case STATE_FAILTERM:
 		dev_dbg_ratelimited(dev, "%s: device has failed\n", __func__);
-		scp->result = 0;
+		clear_scsi_result(scp);
 		set_host_byte(scp, DID_NO_CONNECT);
 		scp->scsi_done(scp);
 		rc = 0;
diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c
index 89995bb09a94..a71f6cc5ff97 100644
--- a/drivers/scsi/dc395x.c
+++ b/drivers/scsi/dc395x.c
@@ -1086,7 +1086,7 @@  static int dc395x_queue_command_lck(struct scsi_cmnd *cmd, void (*done)(struct s
 		cmd, cmd->device->id, (u8)cmd->device->lun, cmd->cmnd[0]);
 
 	/* Assume BAD_TARGET; will be cleared later */
-	cmd->result = 0;
+	clear_scsi_result(cmd);
 	set_host_byte(cmd, DID_BAD_TARGET);
 
 	/* ignore invalid targets */
@@ -1114,7 +1114,7 @@  static int dc395x_queue_command_lck(struct scsi_cmnd *cmd, void (*done)(struct s
 
 	/* set callback and clear result in the command */
 	cmd->scsi_done = done;
-	cmd->result = 0;
+	clear_scsi_result(cmd);
 
 	srb = srb_get_free(acb);
 	if (!srb)
@@ -1382,7 +1382,7 @@  static int dc395x_eh_abort(struct scsi_cmnd *cmd)
 		free_tag(dcb, srb);
 		srb_free_insert(acb, srb);
 		dprintkl(KERN_DEBUG, "eh_abort: Command was waiting\n");
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_ABORT);
 		return SUCCESS;
 	}
@@ -3377,7 +3377,7 @@  static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb,
 		}
 
 		if (status == SAM_STAT_CHECK_CONDITION) {
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_BAD_TARGET);
 			goto ckc_e;
 		}
@@ -3419,7 +3419,7 @@  static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb,
 		} else if (status == SCSI_STAT_SEL_TIMEOUT) {
 			srb->adapter_status = H_SEL_TIMEOUT;
 			srb->target_status = 0;
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_NO_CONNECT);
 		} else {
 			srb->adapter_status = 0;
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index 2f281fd67596..cb233d4825ad 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -436,7 +436,7 @@  static int adpt_queue_lck(struct scsi_cmnd * cmd, void (*done) (struct scsi_cmnd
 	 */
 
 	if ((cmd->cmnd[0] == REQUEST_SENSE) && (cmd->sense_buffer[0] != 0)) {
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_OK);
 		cmd->scsi_done(cmd);
 		return 0;
@@ -462,7 +462,7 @@  static int adpt_queue_lck(struct scsi_cmnd * cmd, void (*done) (struct scsi_cmnd
 		if ((pDev = adpt_find_device(pHba, (u32)cmd->device->channel, (u32)cmd->device->id, cmd->device->lun)) == NULL) {
 			// TODO: if any luns are at this bus, scsi id then fake a TEST_UNIT_READY and INQUIRY response 
 			// with type 7F (for all luns less than the max for this bus,id) so the lun scan will continue.
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_NO_CONNECT);
 			cmd->scsi_done(cmd);
 			return 0;
@@ -2396,17 +2396,17 @@  static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd)
 	if(!(reply_flags & MSG_FAIL)) {
 		switch(detailed_status & I2O_SCSI_DSC_MASK) {
 		case I2O_SCSI_DSC_SUCCESS:
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_OK);
 			// handle underflow
 			if (readl(reply+20) < cmd->underflow) {
-				cmd->result = 0;
+				clear_scsi_result(cmd);
 				set_host_byte(cmd, DID_ERROR);
 				printk(KERN_WARNING"%s: SCSI CMD underflow\n",pHba->name);
 			}
 			break;
 		case I2O_SCSI_DSC_REQUEST_ABORTED:
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_ABORT);
 			break;
 		case I2O_SCSI_DSC_PATH_INVALID:
@@ -2417,22 +2417,22 @@  static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd)
 		case I2O_SCSI_DSC_RESOURCE_UNAVAILABLE:
 			printk(KERN_WARNING"%s: SCSI Timeout-Device (%d,%d,%llu) hba status=0x%x, dev status=0x%x, cmd=0x%x\n",
 				pHba->name, (u32)cmd->device->channel, (u32)cmd->device->id, cmd->device->lun, hba_status, dev_status, cmd->cmnd[0]);
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_TIME_OUT);
 			break;
 		case I2O_SCSI_DSC_ADAPTER_BUSY:
 		case I2O_SCSI_DSC_BUS_BUSY:
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_BUS_BUSY);
 			break;
 		case I2O_SCSI_DSC_SCSI_BUS_RESET:
 		case I2O_SCSI_DSC_BDR_MESSAGE_SENT:
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_RESET);
 			break;
 		case I2O_SCSI_DSC_PARITY_ERROR_FAILURE:
 			printk(KERN_WARNING"%s: SCSI CMD parity error\n",pHba->name);
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_PARITY);
 			break;
 		case I2O_SCSI_DSC_UNABLE_TO_ABORT:
@@ -2462,7 +2462,7 @@  static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd)
 			printk(KERN_WARNING"%s: SCSI error %0x-Device(%d,%d,%llu) hba_status=0x%x, dev_status=0x%x, cmd=0x%x\n",
 				pHba->name, detailed_status & I2O_SCSI_DSC_MASK, (u32)cmd->device->channel, (u32)cmd->device->id, cmd->device->lun,
 			       hba_status, dev_status, cmd->cmnd[0]);
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_ERROR);
 			break;
 		}
@@ -2476,7 +2476,7 @@  static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd)
 			if(cmd->sense_buffer[0] == 0x70 /* class 7 */ && 
 			   cmd->sense_buffer[2] == DATA_PROTECT ){
 				/* This is to handle an array failed */
-				cmd->result = 0;
+				clear_scsi_result(cmd);
 				set_host_byte(cmd, DID_TIME_OUT);
 				printk(KERN_WARNING"%s: SCSI Data Protect-Device (%d,%d,%llu) hba_status=0x%x, dev_status=0x%x, cmd=0x%x\n",
 					pHba->name, (u32)cmd->device->channel, (u32)cmd->device->id, cmd->device->lun,
@@ -2489,7 +2489,7 @@  static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd)
 		 * the card rejected it.  We should signal a retry
 		 * for a limitted number of retries.
 		 */
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_TIME_OUT);
 		printk(KERN_WARNING"%s: I2O MSG_FAIL - Device (%d,%d,%llu) tid=%d, cmd=0x%x\n",
 			pHba->name, (u32)cmd->device->channel, (u32)cmd->device->id, cmd->device->lun,
diff --git a/drivers/scsi/esas2r/esas2r_main.c b/drivers/scsi/esas2r/esas2r_main.c
index c3b6fe1afe5c..b3ac8a8121c1 100644
--- a/drivers/scsi/esas2r/esas2r_main.c
+++ b/drivers/scsi/esas2r/esas2r_main.c
@@ -819,11 +819,11 @@  int esas2r_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
 	unsigned bufflen;
 
 	/* Assume success, if it fails we will fix the result later. */
-	cmd->result = 0;
+	clear_scsi_result(cmd);
 	set_host_byte(cmd, DID_OK);
 
 	if (unlikely(test_bit(AF_DEGRADED_MODE, &a->flags))) {
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_NO_CONNECT);
 		cmd->scsi_done(cmd);
 		return 0;
@@ -985,7 +985,7 @@  int esas2r_eh_abort(struct scsi_cmnd *cmd)
 	esas2r_log(ESAS2R_LOG_INFO, "eh_abort (%p)", cmd);
 
 	if (test_bit(AF_DEGRADED_MODE, &a->flags)) {
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_ABORT);
 
 		scsi_set_resid(cmd, 0);
@@ -1052,7 +1052,7 @@  int esas2r_eh_abort(struct scsi_cmnd *cmd)
 	 * freed it, or we didn't find it at all.  Either way, success!
 	 */
 
-	cmd->result = 0;
+	clear_scsi_result(cmd);
 	set_host_byte(cmd, DID_ABORT);
 
 	scsi_set_resid(cmd, 0);
diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c
index d28844e669cb..40862584a5e2 100644
--- a/drivers/scsi/esp_scsi.c
+++ b/drivers/scsi/esp_scsi.c
@@ -2034,7 +2034,7 @@  static void esp_reset_cleanup_one(struct esp *esp, struct esp_cmd_entry *ent)
 
 	esp_unmap_dma(esp, cmd);
 	esp_free_lun_tag(ent, cmd->device->hostdata);
-	cmd->result = 0;
+	clear_scsi_result(cmd);
 	set_host_byte(cmd, DID_RESET);
 
 	if (ent->flags & ESP_CMD_FLAG_AUTOSENSE) {
@@ -2065,7 +2065,7 @@  static void esp_reset_cleanup(struct esp *esp)
 		struct scsi_cmnd *cmd = ent->cmd;
 
 		list_del(&ent->list);
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_RESET);
 		cmd->scsi_done(cmd);
 		esp_put_ent(esp, ent);
@@ -2539,7 +2539,7 @@  static int esp_eh_abort_handler(struct scsi_cmnd *cmd)
 		 */
 		list_del(&ent->list);
 
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_ABORT);
 		cmd->scsi_done(cmd);
 
diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
index 4a3c94eddd09..7e2a77c9e9c8 100644
--- a/drivers/scsi/fnic/fnic_scsi.c
+++ b/drivers/scsi/fnic/fnic_scsi.c
@@ -450,7 +450,7 @@  static int fnic_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_
 	if (!rport) {
 		FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host,
 				"returning DID_NO_CONNECT for IO as rport is NULL\n");
-		sc->result = 0;
+		clear_scsi_result(sc);
 		set_host_byte(sc, DID_NO_CONNECT);
 		done(sc);
 		return 0;
@@ -473,7 +473,7 @@  static int fnic_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_
 			rport->port_id);
 
 		atomic64_inc(&fnic_stats->misc_stats.rport_not_ready);
-		sc->result = 0;
+		clear_scsi_result(sc);
 		set_host_byte(sc, DID_NO_CONNECT);
 		done(sc);
 		return 0;
@@ -484,7 +484,7 @@  static int fnic_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_
 			"rport 0x%x in state 0x%x, returning DID_IMM_RETRY\n",
 			rport->port_id, rp->rp_state);
 
-		sc->result = 0;
+		clear_scsi_result(sc);
 		set_host_byte(sc, DID_IMM_RETRY);
 		done(sc);
 		return 0;
@@ -1194,7 +1194,7 @@  static void fnic_fcpio_itmf_cmpl_handler(struct fnic *fnic,
 			FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host,
 				      "abts cmpl, completing IO\n");
 			CMD_SP(sc) = NULL;
-			sc->result = 0;
+			clear_scsi_result(sc);
 			set_host_byte(sc, DID_ERROR);
 
 			spin_unlock_irqrestore(io_lock, flags);
@@ -1407,7 +1407,7 @@  static void fnic_cleanup_io(struct fnic *fnic, int exclude_id)
 		mempool_free(io_req, fnic->io_req_pool);
 
 cleanup_scsi_cmd:
-		sc->result = 0;
+		clear_scsi_result(sc);
 		set_host_byte(sc, DID_TRANSPORT_DISRUPTED);
 		FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host,
 			      "%s: sc duration = %lu DID_TRANSPORT_DISRUPTED\n",
@@ -1478,7 +1478,7 @@  void fnic_wq_copy_cleanup_handler(struct vnic_wq_copy *wq,
 	mempool_free(io_req, fnic->io_req_pool);
 
 wq_copy_cleanup_scsi_cmd:
-	sc->result = 0;
+	clear_scsi_result(sc);
 	set_host_byte(sc, DID_NO_CONNECT);
 	FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, "wq_copy_cleanup_handler:"
 		      " DID_NO_CONNECT\n");
@@ -2025,7 +2025,7 @@  int fnic_abort_cmd(struct scsi_cmnd *sc)
 
 	if (sc->scsi_done) {
 	/* Call SCSI completion function to complete the IO */
-		sc->result = 0;
+		clear_scsi_result(sc);
 		set_host_byte(sc, DID_ABORT);
 		sc->scsi_done(sc);
 		atomic64_dec(&fnic_stats->io_stats.active_ios);
@@ -2259,7 +2259,7 @@  static int fnic_clean_pending_aborts(struct fnic *fnic,
 		 */
 		if (sc->scsi_done) {
 			/* Set result to let upper SCSI layer retry */
-			sc->result = 0;
+			clear_scsi_result(sc);
 			set_host_byte(sc, DID_RESET);
 			sc->scsi_done(sc);
 		}
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index f34fb220be4f..0db7e29026fa 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -2146,7 +2146,7 @@  static void gdth_next(gdth_ha_str *ha)
         } else if (t >= MAX_HDRIVES || !ha->hdr[t].present || l != 0) {
             TRACE2(("Command 0x%x to bus %d id %d lun %d -> IGNORE\n",
                     nscp->cmnd[0], b, t, l));
-            nscp->result = 0;
+            clear_scsi_result(nscp);
             set_host_byte(nscp, DID_BAD_TARGET);
             if (!nscp_cmndinfo->wait_for_completion)
                 nscp_cmndinfo->wait_for_completion++;
@@ -2189,7 +2189,7 @@  static void gdth_next(gdth_ha_str *ha)
                        nscp->cmnd[4],nscp->cmnd[5]));
                 if ( (nscp->cmnd[4]&1) && !(ha->hdr[t].devtype&1) ) {
                     TRACE(("Prevent r. nonremov. drive->do nothing\n"));
-                    nscp->result = 0;
+                    clear_scsi_result(nscp);
                     set_host_byte(nscp, DID_OK);
                     nscp->sense_buffer[0] = 0;
                     if (!nscp_cmndinfo->wait_for_completion)
@@ -2243,7 +2243,7 @@  static void gdth_next(gdth_ha_str *ha)
                         nscp->cmnd[4],nscp->cmnd[5]));
                 printk("GDT-HA %d: Unknown SCSI command 0x%x to cache service !\n",
                        ha->hanum, nscp->cmnd[0]);
-                nscp->result = 0;
+                clear_scsi_result(nscp);
                 set_host_byte(nscp, DID_ABORT);
                 if (!nscp_cmndinfo->wait_for_completion)
                     nscp_cmndinfo->wait_for_completion++;
@@ -2336,7 +2336,7 @@  static int gdth_internal_cache_cmd(gdth_ha_str *ha, struct scsi_cmnd *scp)
     TRACE(("gdth_internal_cache_cmd() cmd 0x%x hdrive %d\n",
            scp->cmnd[0],t));
 
-    scp->result = 0;
+    clear_scsi_result(scp);
     set_host_byte(scp, DID_OK);
     scp->sense_buffer[0] = 0;
 
@@ -2409,7 +2409,7 @@  static int gdth_internal_cache_cmd(gdth_ha_str *ha, struct scsi_cmnd *scp)
             gdth_copy_internal_data(ha, scp, (char*)&rdc16,
                                                  sizeof(gdth_rdcap16_data));
         } else { 
-            scp->result = 0;
+            clear_scsi_result(scp);
             set_host_byte(scp, DID_ABORT);
         }
         break;
@@ -3368,7 +3368,7 @@  static int gdth_sync_event(gdth_ha_str *ha, int service, u8 index,
                 } else if (scp->cmnd[0] == RELEASE) {
                     ha->hdr[t].cluster_type &= ~CLUSTER_RESERVED;
                 }           
-                scp->result = 0;
+                clear_scsi_result(scp);
                 set_host_byte(scp, DID_OK);
                 scp->sense_buffer[0] = 0;
             }
@@ -3421,7 +3421,7 @@  static int gdth_sync_event(gdth_ha_str *ha, int service, u8 index,
             } else {
                 /* sense buffer filled from controller firmware (DMA) */
                 if (ha->status != S_RAW_SCSI || ha->info >= 0x100) {
-                    scp->result = 0;
+                    clear_scsi_result(scp);
                     set_host_byte(scp, DID_BAD_TARGET);
                 } else {
                     set_scsi_result(scp, 0, DID_OK, 0, ha->info);
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 7ad59c8babc6..5221412c3163 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -2363,7 +2363,7 @@  static int handle_ioaccel_mode2_error(struct ctlr_info *h,
 			retry = 1;
 			break;
 		case IOACCEL2_STATUS_SR_UNDERRUN:
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_OK);		/* host byte */
 			set_msg_byte(cmd, COMMAND_COMPLETE);	/* msg byte */
 			ioaccel2_resid = get_unaligned_le32(
@@ -2382,7 +2382,7 @@  static int handle_ioaccel_mode2_error(struct ctlr_info *h,
 			 * of the disk to get the same device node.
 			 */
 			if (dev->physical_device && dev->expose_device) {
-				cmd->result = 0;
+				clear_scsi_result(cmd);
 				set_host_byte(cmd, DID_NO_CONNECT);
 				dev->removed = 1;
 				h->drv_req_rescan = 1;
@@ -2551,14 +2551,14 @@  static void complete_scsi_command(struct CommandList *cp)
 	h = cp->h;
 
 	if (!cmd->device) {
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_NO_CONNECT);
 		return hpsa_cmd_free_and_done(h, cp, cmd);
 	}
 
 	dev = cmd->device->hostdata;
 	if (!dev) {
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_NO_CONNECT);
 		return hpsa_cmd_free_and_done(h, cp, cmd);
 	}
@@ -2573,14 +2573,14 @@  static void complete_scsi_command(struct CommandList *cp)
 		(c2->sg[0].chain_indicator == IOACCEL2_CHAIN))
 		hpsa_unmap_ioaccel2_sg_chain_block(h, c2);
 
-	cmd->result = 0;
+	clear_scsi_result(cmd);
 	set_host_byte(cmd, DID_OK); 		/* host byte */
 	set_msg_byte(cmd, COMMAND_COMPLETE);	/* msg byte */
 
 	if (cp->cmd_type == CMD_IOACCEL2 || cp->cmd_type == CMD_IOACCEL1) {
 		if (dev->physical_device && dev->expose_device &&
 			dev->removed) {
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_NO_CONNECT);
 			return hpsa_cmd_free_and_done(h, cp, cmd);
 		}
@@ -2595,7 +2595,7 @@  static void complete_scsi_command(struct CommandList *cp)
 	 */
 	if (unlikely(ei->CommandStatus == CMD_CTLR_LOCKUP)) {
 		/* DID_NO_CONNECT will prevent a retry */
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_NO_CONNECT);
 		return hpsa_cmd_free_and_done(h, cp, cmd);
 	}
@@ -2703,58 +2703,58 @@  static void complete_scsi_command(struct CommandList *cp)
 		 * This is kind of a shame because it means that any other
 		 * CMD_INVALID (e.g. driver bug) will get interpreted as a
 		 * missing target. */
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_NO_CONNECT);
 	}
 		break;
 	case CMD_PROTOCOL_ERR:
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_ERROR);
 		dev_warn(&h->pdev->dev, "CDB %16phN : protocol error\n",
 				cp->Request.CDB);
 		break;
 	case CMD_HARDWARE_ERR:
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_ERROR);
 		dev_warn(&h->pdev->dev, "CDB %16phN : hardware error\n",
 			cp->Request.CDB);
 		break;
 	case CMD_CONNECTION_LOST:
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_ERROR);
 		dev_warn(&h->pdev->dev, "CDB %16phN : connection lost\n",
 			cp->Request.CDB);
 		break;
 	case CMD_ABORTED:
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_ABORT);
 		break;
 	case CMD_ABORT_FAILED:
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_ERROR);
 		dev_warn(&h->pdev->dev, "CDB %16phN : abort failed\n",
 			cp->Request.CDB);
 		break;
 	case CMD_UNSOLICITED_ABORT:
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_SOFT_ERROR); /* retry the command */
 		dev_warn(&h->pdev->dev, "CDB %16phN : unsolicited abort\n",
 			cp->Request.CDB);
 		break;
 	case CMD_TIMEOUT:
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_TIME_OUT);
 		dev_warn(&h->pdev->dev, "CDB %16phN timed out\n",
 			cp->Request.CDB);
 		break;
 	case CMD_UNABORTABLE:
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_ERROR);
 		dev_warn(&h->pdev->dev, "Command unabortable\n");
 		break;
 	case CMD_TMF_STATUS:
 		if (hpsa_evaluate_tmf_status(h, cp)) /* TMF failed? */ {
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_ERROR);
 		}
 		break;
@@ -2762,13 +2762,13 @@  static void complete_scsi_command(struct CommandList *cp)
 		/* This only handles the direct pass-through case since RAID
 		 * offload is handled above.  Just attempt a retry.
 		 */
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_SOFT_ERROR);
 		dev_warn(&h->pdev->dev,
 				"cp %p had HP SSD Smart Path error\n", cp);
 		break;
 	default:
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_ERROR);
 		dev_warn(&h->pdev->dev, "cp %p returned unknown status %x\n",
 				cp, ei->CommandStatus);
@@ -5552,7 +5552,7 @@  static void hpsa_command_resubmit_worker(struct work_struct *work)
 	cmd = c->scsi_cmd;
 	dev = cmd->device->hostdata;
 	if (!dev) {
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_NO_CONNECT);
 		return hpsa_cmd_free_and_done(c->h, c, cmd);
 	}
@@ -5574,7 +5574,7 @@  static void hpsa_command_resubmit_worker(struct work_struct *work)
 				 * Try again via scsi mid layer, which will
 				 * then get SCSI_MLQUEUE_HOST_BUSY.
 				 */
-				cmd->result = 0;
+				clear_scsi_result(cmd);
 				set_host_byte(cmd, DID_IMM_RETRY);
 				return hpsa_cmd_free_and_done(h, c, cmd);
 			}
@@ -5591,7 +5591,7 @@  static void hpsa_command_resubmit_worker(struct work_struct *work)
 		 * hpsa_ciss_submit will have already freed c
 		 * if it encountered a dma mapping failure.
 		 */
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_IMM_RETRY);
 		cmd->scsi_done(cmd);
 	}
@@ -5613,14 +5613,14 @@  static int hpsa_scsi_queue_command(struct Scsi_Host *sh, struct scsi_cmnd *cmd)
 
 	dev = cmd->device->hostdata;
 	if (!dev) {
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_NO_CONNECT);
 		cmd->scsi_done(cmd);
 		return 0;
 	}
 
 	if (dev->removed) {
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_NO_CONNECT);
 		cmd->scsi_done(cmd);
 		return 0;
@@ -5629,7 +5629,7 @@  static int hpsa_scsi_queue_command(struct Scsi_Host *sh, struct scsi_cmnd *cmd)
 	memcpy(scsi3addr, dev->scsi3addr, sizeof(scsi3addr));
 
 	if (unlikely(lockup_detected(h))) {
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_NO_CONNECT);
 		cmd->scsi_done(cmd);
 		return 0;
diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c
index 84bfdc57e7ef..10cd2a97c1b8 100644
--- a/drivers/scsi/hptiop.c
+++ b/drivers/scsi/hptiop.c
@@ -743,27 +743,27 @@  static void hptiop_finish_scsi_req(struct hptiop_hba *hba, u32 tag,
 	case IOP_RESULT_SUCCESS:
 		scsi_set_resid(scp,
 			scsi_bufflen(scp) - le32_to_cpu(req->dataxfer_length));
-		scp->result = 0;
+		clear_scsi_result(scp);
 		set_host_byte(scp, DID_OK);
 		break;
 	case IOP_RESULT_BAD_TARGET:
-		scp->result = 0;
+		clear_scsi_result(scp);
 		set_host_byte(scp, DID_BAD_TARGET);
 		break;
 	case IOP_RESULT_BUSY:
-		scp->result = 0;
+		clear_scsi_result(scp);
 		set_host_byte(scp, DID_BUS_BUSY);
 		break;
 	case IOP_RESULT_RESET:
-		scp->result = 0;
+		clear_scsi_result(scp);
 		set_host_byte(scp, DID_RESET);
 		break;
 	case IOP_RESULT_FAIL:
-		scp->result = 0;
+		clear_scsi_result(scp);
 		set_host_byte(scp, DID_ERROR);
 		break;
 	case IOP_RESULT_INVALID_REQUEST:
-		scp->result = 0;
+		clear_scsi_result(scp);
 		set_host_byte(scp, DID_ABORT);
 		break;
 	case IOP_RESULT_CHECK_CONDITION:
@@ -1039,12 +1039,12 @@  static int hptiop_queuecommand_lck(struct scsi_cmnd *scp,
 			cpu_to_be32(((u32 *)scp->cmnd)[3]),
 			_req->index, _req->req_virt);
 
-	scp->result = 0;
+	clear_scsi_result(scp);
 
 	if (scp->device->channel ||
 			(scp->device->id > hba->max_devices) ||
 			((scp->device->id == (hba->max_devices-1)) && scp->device->lun)) {
-		scp->result = 0;
+		clear_scsi_result(scp);
 		set_host_byte(scp, DID_BAD_TARGET);
 		free_req(hba, _req);
 		goto cmd_done;
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index 3755bb824e71..37e8b5bd9d6e 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -808,7 +808,7 @@  static void ibmvfc_scsi_eh_done(struct ibmvfc_event *evt)
 static void ibmvfc_fail_request(struct ibmvfc_event *evt, int error_code)
 {
 	if (evt->cmnd) {
-		evt->cmnd->result = 0;
+		clear_scsi_result(evt->cmnd);
 		set_host_byte(evt->cmnd, error_code);
 		evt->done = ibmvfc_scsi_eh_done;
 	} else
@@ -1456,7 +1456,7 @@  static int ibmvfc_send_event(struct ibmvfc_event *evt,
 
 		dev_err(vhost->dev, "Send error (rc=%d)\n", rc);
 		if (evt->cmnd) {
-			evt->cmnd->result = 0;
+			clear_scsi_result(evt->cmnd);
 			set_host_byte(evt->cmnd, DID_ERROR);
 			evt->done = ibmvfc_scsi_eh_done;
 		} else
@@ -1559,7 +1559,7 @@  static void ibmvfc_scsi_done(struct ibmvfc_event *evt)
 				ibmvfc_relogin(cmnd->device);
 
 			if (!cmnd->result && (!scsi_get_resid(cmnd) || (rsp->flags & FCP_RESID_OVER))) {
-				cmnd->result = 0;
+				clear_scsi_result(cmnd);
 				set_host_byte(cmnd, DID_ERROR);
 			}
 
@@ -1568,7 +1568,7 @@  static void ibmvfc_scsi_done(struct ibmvfc_event *evt)
 
 		if (!cmnd->result &&
 		    (scsi_bufflen(cmnd) - scsi_get_resid(cmnd) < cmnd->underflow)) {
-			cmnd->result = 0;
+			clear_scsi_result(cmnd);
 			set_host_byte(cmnd, DID_ERROR);
 		}
 
@@ -1636,7 +1636,7 @@  static int ibmvfc_queuecommand_lck(struct scsi_cmnd *cmnd,
 		return 0;
 	}
 
-	cmnd->result = 0;
+	clear_scsi_result(cmnd);
 	set_host_byte(cmnd, DID_OK);
 	evt = ibmvfc_get_event(vhost);
 	ibmvfc_init_event(evt, ibmvfc_scsi_done, IBMVFC_CMD_FORMAT);
@@ -1671,7 +1671,7 @@  static int ibmvfc_queuecommand_lck(struct scsi_cmnd *cmnd,
 		scmd_printk(KERN_ERR, cmnd,
 			    "Failed to map DMA buffer for command. rc=%d\n", rc);
 
-	cmnd->result = 0;
+	clear_scsi_result(cmnd);
 	set_host_byte(cmnd, DID_ERROR);
 	done(cmnd);
 	return 0;
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index a435a1f3bdbd..27c7855fc82d 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -803,7 +803,7 @@  static void purge_requests(struct ibmvscsi_host_data *hostdata, int error_code)
 
 		spin_unlock_irqrestore(hostdata->host->host_lock, flags);
 		if (evt->cmnd) {
-			evt->cmnd->result = 0;
+			clear_scsi_result(evt->cmnd);
 			set_host_byte(evt->cmnd, error_code);
 			unmap_cmd_data(&evt->iu.srp.cmd, evt,
 				       evt->hostdata->dev);
@@ -971,7 +971,7 @@  static int ibmvscsi_send_srp_event(struct srp_event_struct *evt_struct,
 	unmap_cmd_data(&evt_struct->iu.srp.cmd, evt_struct, hostdata->dev);
 
 	if (evt_struct->cmnd != NULL) {
-		evt_struct->cmnd->result = 0;
+		clear_scsi_result(evt_struct->cmnd);
 		set_host_byte(evt_struct->cmnd, DID_ERROR);
 		evt_struct->cmnd_done(evt_struct->cmnd);
 	} else if (evt_struct->done)
@@ -1045,7 +1045,7 @@  static int ibmvscsi_queuecommand_lck(struct scsi_cmnd *cmnd,
 	u16 lun = lun_from_dev(cmnd->device);
 	u8 out_fmt, in_fmt;
 
-	cmnd->result = 0;
+	clear_scsi_result(cmnd);
 	set_host_byte(cmnd, DID_OK);
 	evt_struct = get_event_struct(&hostdata->pool);
 	if (!evt_struct)
@@ -1607,7 +1607,7 @@  static int ibmvscsi_eh_abort_handler(struct scsi_cmnd *cmd)
 	sdev_printk(KERN_INFO, cmd->device, "successfully aborted task tag 0x%llx\n",
 		    tsk_mgmt->task_tag);
 
-	cmd->result = 0;
+	clear_scsi_result(cmd);
 	set_host_byte(cmd, DID_ABORT);
 	list_del(&found_evt->list);
 	unmap_cmd_data(&found_evt->iu.srp.cmd, found_evt,
@@ -1713,7 +1713,7 @@  static int ibmvscsi_eh_device_reset_handler(struct scsi_cmnd *cmd)
 	list_for_each_entry_safe(tmp_evt, pos, &hostdata->sent, list) {
 		if ((tmp_evt->cmnd) && (tmp_evt->cmnd->device == cmd->device)) {
 			if (tmp_evt->cmnd) {
-				tmp_evt->cmnd->result = 0;
+				clear_scsi_result(tmp_evt->cmnd);
 				set_host_byte(tmp_evt->cmnd, DID_RESET);
 			}
 			list_del(&tmp_evt->list);
@@ -1844,7 +1844,7 @@  static void ibmvscsi_handle_crq(struct viosrp_crq *crq,
 	del_timer(&evt_struct->timer);
 
 	if ((crq->status != VIOSRP_OK && crq->status != VIOSRP_OK2) && evt_struct->cmnd) {
-		evt_struct->cmnd->result = 0;
+		clear_scsi_result(evt_struct->cmnd);
 		set_host_byte(evt_struct->cmnd, DID_ERROR);
 	}
 	if (evt_struct->done)
diff --git a/drivers/scsi/imm.c b/drivers/scsi/imm.c
index 0130af30219c..f74658b83354 100644
--- a/drivers/scsi/imm.c
+++ b/drivers/scsi/imm.c
@@ -157,7 +157,7 @@  imm_fail(imm_struct *dev, int error_code)
 {
 	/* If we fail a device then we trash status / message bytes */
 	if (dev->cur_cmd) {
-		dev->cur_cmd->result = 0;
+		clear_scsi_result(dev->cur_cmd);
 		set_host_byte(dev->cur_cmd, error_code);
 		dev->failed = 1;
 	}
@@ -923,7 +923,7 @@  static int imm_queuecommand_lck(struct scsi_cmnd *cmd,
 	dev->jstart = jiffies;
 	dev->cur_cmd = cmd;
 	cmd->scsi_done = done;
-	cmd->result = 0;
+	clear_scsi_result(cmd);
 	set_host_byte(cmd, DID_ERROR);	/* default return code */
 	cmd->SCp.phase = 0;	/* bus free */
 
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 334fd09c574d..8dbd4b6058f2 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -6525,7 +6525,7 @@  static int ipr_queuecommand(struct Scsi_Host *shost,
 
 	ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata;
 
-	scsi_cmd->result = 0;
+	clear_scsi_result(scsi_cmd);
 	set_host_byte(scsi_cmd, DID_OK);
 	res = scsi_cmd->device->hostdata;
 
@@ -6639,7 +6639,7 @@  static int ipr_queuecommand(struct Scsi_Host *shost,
 err_nodev:
 	spin_lock_irqsave(hrrq->lock, hrrq_flags);
 	memset(scsi_cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
-	scsi_cmd->result = 0;
+	clear_scsi_result(scsi_cmd);
 	set_host_byte(scsi_cmd, DID_NO_CONNECT);
 	scsi_cmd->scsi_done(scsi_cmd);
 	spin_unlock_irqrestore(hrrq->lock, hrrq_flags);
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
index 73d03f96a102..b6b5f5e95e25 100644
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -936,7 +936,7 @@  static int __ips_eh_reset(struct scsi_cmnd *SC)
 			  ips_name, ha->host_num);
 
 		while ((scb = ips_removeq_scb_head(&ha->scb_activelist))) {
-			scb->scsi_cmd->result = 0;
+			clear_scsi_result(scb->scsi_cmd);
 			set_host_byte(scb->scsi_cmd, DID_ERROR);
 			scb->scsi_cmd->scsi_done(scb->scsi_cmd);
 			ips_freescb(ha, scb);
@@ -947,7 +947,7 @@  static int __ips_eh_reset(struct scsi_cmnd *SC)
 			  ips_name, ha->host_num);
 
 		while ((scsi_cmd = ips_removeq_wait_head(&ha->scb_waitlist))) {
-			scsi_cmd->result = 0;
+			clear_scsi_result(scsi_cmd);
 			set_host_byte(scsi_cmd, DID_ERROR);
 			scsi_cmd->scsi_done(scsi_cmd);
 		}
@@ -967,7 +967,7 @@  static int __ips_eh_reset(struct scsi_cmnd *SC)
 			  ips_name, ha->host_num);
 
 		while ((scb = ips_removeq_scb_head(&ha->scb_activelist))) {
-			scb->scsi_cmd->result = 0;
+			clear_scsi_result(scb->scsi_cmd);
 			set_host_byte(scb->scsi_cmd, DID_ERROR);
 			scb->scsi_cmd->scsi_done(scb->scsi_cmd);
 			ips_freescb(ha, scb);
@@ -978,7 +978,7 @@  static int __ips_eh_reset(struct scsi_cmnd *SC)
 			  ips_name, ha->host_num);
 
 		while ((scsi_cmd = ips_removeq_wait_head(&ha->scb_waitlist))) {
-			scsi_cmd->result = 0;
+			clear_scsi_result(scsi_cmd);
 			set_host_byte(scsi_cmd, DID_ERROR);
 			scsi_cmd->scsi_done(scsi_cmd);
 		}
@@ -1001,7 +1001,7 @@  static int __ips_eh_reset(struct scsi_cmnd *SC)
 	DEBUG_VAR(1, "(%s%d) Failing active commands", ips_name, ha->host_num);
 
 	while ((scb = ips_removeq_scb_head(&ha->scb_activelist))) {
-		scb->scsi_cmd->result = 0;
+		clear_scsi_result(scb->scsi_cmd);
 		set_host_byte(scb->scsi_cmd, DID_RESET);
 		scb->scsi_cmd->scsi_done(scb->scsi_cmd);
 		ips_freescb(ha, scb);
@@ -1061,14 +1061,14 @@  static int ips_queue_lck(struct scsi_cmnd *SC, void (*done) (struct scsi_cmnd *)
 
 	if (ips_is_passthru(SC)) {
 		if (ha->copp_waitlist.count == IPS_MAX_IOCTL_QUEUE) {
-			SC->result = 0;
+			clear_scsi_result(SC);
 			set_host_byte(SC, DID_BUS_BUSY);
 			done(SC);
 
 			return (0);
 		}
 	} else if (ha->scb_waitlist.count == IPS_MAX_QUEUE) {
-		SC->result = 0;
+		clear_scsi_result(SC);
 		set_host_byte(SC, DID_BUS_BUSY);
 		done(SC);
 
@@ -1086,7 +1086,7 @@  static int ips_queue_lck(struct scsi_cmnd *SC, void (*done) (struct scsi_cmnd *)
 	/* Check for command to initiator IDs */
 	if ((scmd_channel(SC) > 0)
 	    && (scmd_id(SC) == ha->ha_id[scmd_channel(SC)])) {
-		SC->result = 0;
+		clear_scsi_result(SC);
 		set_host_byte(SC, DID_NO_CONNECT);
 		done(SC);
 
@@ -1104,14 +1104,14 @@  static int ips_queue_lck(struct scsi_cmnd *SC, void (*done) (struct scsi_cmnd *)
 		if ((pt->CoppCP.cmd.reset.op_code == IPS_CMD_RESET_CHANNEL) &&
 		    (pt->CoppCP.cmd.reset.adapter_flag == 1)) {
 			if (ha->scb_activelist.count != 0) {
-				SC->result = 0;
+				clear_scsi_result(SC);
 				set_host_byte(SC, DID_BUS_BUSY);
 				done(SC);
 				return (0);
 			}
 			ha->ioctl_reset = 1;	/* This reset request is from an IOCTL */
 			__ips_eh_reset(SC);
-			SC->result = 0;
+			clear_scsi_result(SC);
 			set_host_byte(SC, DID_OK);
 			SC->scsi_done(SC);
 			return (0);
@@ -1121,7 +1121,7 @@  static int ips_queue_lck(struct scsi_cmnd *SC, void (*done) (struct scsi_cmnd *)
 		scratch = kmalloc(sizeof (ips_copp_wait_item_t), GFP_ATOMIC);
 
 		if (!scratch) {
-			SC->result = 0;
+			clear_scsi_result(SC);
 			set_host_byte(SC, DID_ERROR);
 			done(SC);
 
@@ -1619,7 +1619,7 @@  ips_make_passthru(ips_ha_t *ha, struct scsi_cmnd *SC, ips_scb_t *scb, int intr)
 		       &ips_num_controllers, sizeof (int));
 		ips_scmd_buf_write(SC, ha->ioctl_data,
 				   sizeof (ips_passthru_t) + sizeof (int));
-		SC->result = 0;
+		clear_scsi_result(SC);
 		set_host_byte(SC, DID_OK);
 
 		return (IPS_SUCCESS_IMM);
@@ -1677,7 +1677,7 @@  ips_flash_copperhead(ips_ha_t * ha, ips_passthru_t * pt, ips_scb_t * scb)
 	}
 	pt->BasicStatus = 0x0B;
 	pt->ExtendedStatus = 0;
-	scb->scsi_cmd->result = 0;
+	clear_scsi_result(scb->scsi_cmd);
 	set_host_byte(scb->scsi_cmd, DID_OK);
 	/* IF it's OK to Use the "CD BOOT" Flash Buffer, then you can     */
 	/* avoid allocating a huge buffer per adapter ( which can fail ). */
@@ -1881,7 +1881,7 @@  ips_flash_firmware(ips_ha_t * ha, ips_passthru_t * pt, ips_scb_t * scb)
 	scb->cmd.flashfw.buffer_addr = cpu_to_le32(scb->data_busaddr);
 	if (pt->TimeOut)
 		scb->timeout = pt->TimeOut;
-	scb->scsi_cmd->result = 0;
+	clear_scsi_result(scb->scsi_cmd);
 	set_host_byte(scb->scsi_cmd, DID_OK);
 	return IPS_SUCCESS;
 }
@@ -1984,7 +1984,7 @@  ips_usrcmd(ips_ha_t * ha, ips_passthru_t * pt, ips_scb_t * scb)
 	}
 
 	/* assume success */
-	scb->scsi_cmd->result = 0;
+	clear_scsi_result(scb->scsi_cmd);
 	set_host_byte(scb->scsi_cmd, DID_OK);
 
 	/* success */
@@ -2597,7 +2597,7 @@  ips_next(ips_ha_t * ha, int intr)
 		switch (ret) {
 		case IPS_FAILURE:
 			if (scb->scsi_cmd) {
-				scb->scsi_cmd->result = 0;
+				clear_scsi_result(scb->scsi_cmd);
 				set_host_byte(scb->scsi_cmd, DID_ERROR);
 				scb->scsi_cmd->scsi_done(scb->scsi_cmd);
 			}
@@ -2606,7 +2606,7 @@  ips_next(ips_ha_t * ha, int intr)
 			break;
 		case IPS_SUCCESS_IMM:
 			if (scb->scsi_cmd) {
-				scb->scsi_cmd->result = 0;
+				clear_scsi_result(scb->scsi_cmd);
 				set_host_byte(scb->scsi_cmd, DID_OK);
 				scb->scsi_cmd->scsi_done(scb->scsi_cmd);
 			}
@@ -2632,7 +2632,7 @@  ips_next(ips_ha_t * ha, int intr)
 		switch (ret) {
 		case IPS_FAILURE:
 			if (scb->scsi_cmd) {
-				scb->scsi_cmd->result = 0;
+				clear_scsi_result(scb->scsi_cmd);
 				set_host_byte(scb->scsi_cmd, DID_ERROR);
 			}
 
@@ -2668,7 +2668,7 @@  ips_next(ips_ha_t * ha, int intr)
 		if (intr == IPS_INTR_ON)
 			spin_unlock(host->host_lock);	/* Unlock HA after command is taken off queue */
 
-		SC->result = 0;
+		clear_scsi_result(SC);
 		set_host_byte(SC, DID_OK);
 		SC->host_scribble = NULL;
 
@@ -2734,7 +2734,7 @@  ips_next(ips_ha_t * ha, int intr)
 			break;
 		case IPS_FAILURE:
 			if (scb->scsi_cmd) {
-				scb->scsi_cmd->result = 0;
+				clear_scsi_result(scb->scsi_cmd);
 				set_host_byte(scb->scsi_cmd, DID_ERROR);
 				scb->scsi_cmd->scsi_done(scb->scsi_cmd);
 			}
@@ -3229,7 +3229,7 @@  ips_done(ips_ha_t * ha, ips_scb_t * scb)
 			switch (ret) {
 			case IPS_FAILURE:
 				if (scb->scsi_cmd) {
-					scb->scsi_cmd->result = 0;
+					clear_scsi_result(scb->scsi_cmd);
 					set_host_byte(scb->scsi_cmd,
 						      DID_ERROR);
 					scb->scsi_cmd->scsi_done(scb->scsi_cmd);
@@ -3239,7 +3239,7 @@  ips_done(ips_ha_t * ha, ips_scb_t * scb)
 				break;
 			case IPS_SUCCESS_IMM:
 				if (scb->scsi_cmd) {
-					scb->scsi_cmd->result = 0;
+					clear_scsi_result(scb->scsi_cmd);
 					set_host_byte(scb->scsi_cmd,
 						      DID_ERROR);
 					scb->scsi_cmd->scsi_done(scb->scsi_cmd);
@@ -3512,12 +3512,12 @@  ips_send_cmd(ips_ha_t * ha, ips_scb_t * scb)
 		case ERASE:
 		case WRITE_FILEMARKS:
 		case SPACE:
-			scb->scsi_cmd->result = 0;
+			clear_scsi_result(scb->scsi_cmd);
 			set_host_byte(scb->scsi_cmd, DID_ERROR);
 			break;
 
 		case START_STOP:
-			scb->scsi_cmd->result = 0;
+			clear_scsi_result(scb->scsi_cmd);
 			set_host_byte(scb->scsi_cmd, DID_OK);
 
 		case TEST_UNIT_READY:
@@ -3528,7 +3528,7 @@  ips_send_cmd(ips_ha_t * ha, ips_scb_t * scb)
 				 * or we have a SCSI inquiry
 				 */
 				if (scb->scsi_cmd->cmnd[0] == TEST_UNIT_READY) {
-					scb->scsi_cmd->result = 0;
+					clear_scsi_result(scb->scsi_cmd);
 					set_host_byte(scb->scsi_cmd, DID_OK);
 				}
 
@@ -3562,7 +3562,7 @@  ips_send_cmd(ips_ha_t * ha, ips_scb_t * scb)
 							   &inquiry,
 							   sizeof (inquiry));
 
-					scb->scsi_cmd->result = 0;
+					clear_scsi_result(scb->scsi_cmd);
 					set_host_byte(scb->scsi_cmd, DID_OK);
 				}
 			} else {
@@ -3581,7 +3581,7 @@  ips_send_cmd(ips_ha_t * ha, ips_scb_t * scb)
 
 		case REQUEST_SENSE:
 			ips_reqsen(ha, scb);
-			scb->scsi_cmd->result = 0;
+			clear_scsi_result(scb->scsi_cmd);
 			set_host_byte(scb->scsi_cmd, DID_OK);
 			break;
 
@@ -3678,7 +3678,7 @@  ips_send_cmd(ips_ha_t * ha, ips_scb_t * scb)
 				 * we don't have to do anything
 				 * so just return
 				 */
-				scb->scsi_cmd->result = 0;
+				clear_scsi_result(scb->scsi_cmd);
 				set_host_byte(scb->scsi_cmd, DID_OK);
 			} else
 				ret = IPS_SUCCESS;
@@ -3687,7 +3687,7 @@  ips_send_cmd(ips_ha_t * ha, ips_scb_t * scb)
 
 		case RESERVE:
 		case RELEASE:
-			scb->scsi_cmd->result = 0;
+			clear_scsi_result(scb->scsi_cmd);
 			set_host_byte(scb->scsi_cmd, DID_OK);
 			break;
 
@@ -3722,7 +3722,7 @@  ips_send_cmd(ips_ha_t * ha, ips_scb_t * scb)
 		case READ_DEFECT_DATA:
 		case READ_BUFFER:
 		case WRITE_BUFFER:
-			scb->scsi_cmd->result = 0;
+			clear_scsi_result(scb->scsi_cmd);
 			set_host_byte(scb->scsi_cmd, DID_OK);
 			break;
 
@@ -3754,7 +3754,7 @@  ips_send_cmd(ips_ha_t * ha, ips_scb_t * scb)
 		/* If we already know the Device is Not there, no need to attempt a Command   */
 		/* This also protects an NT FailOver Controller from getting CDB's sent to it */
 		if (ha->conf->dev[scb->bus - 1][scb->target_id].ucState == 0) {
-			scb->scsi_cmd->result = 0;
+			clear_scsi_result(scb->scsi_cmd);
 			set_host_byte(scb->scsi_cmd, DID_NO_CONNECT);
 			return (IPS_SUCCESS_IMM);
 		}
@@ -3995,7 +3995,7 @@  ips_chkstatus(ips_ha_t * ha, IPS_STATUS * pstatus)
 				errcode = DID_ERROR;
 			}	/* end switch */
 
-			scb->scsi_cmd->result = 0;
+			clear_scsi_result(scb->scsi_cmd);
 			set_host_byte(scb->scsi_cmd, errcode);
 		} else {	/* bus == 0 */
 			/* restrict access to physical drives */
@@ -4003,7 +4003,7 @@  ips_chkstatus(ips_ha_t * ha, IPS_STATUS * pstatus)
 			    ips_scmd_buf_read(scb->scsi_cmd,
                                   &inquiryData, sizeof (inquiryData));
 			    if ((inquiryData.DeviceType & 0x1f) == TYPE_DISK) {
-			        scb->scsi_cmd->result = 0;
+			        clear_scsi_result(scb->scsi_cmd);
 			        set_host_byte(scb->scsi_cmd, DID_TIME_OUT);
 			    }
 			}
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index 614ab06e5a53..f86fd13e1c2b 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -1889,7 +1889,7 @@  int fc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *sc_cmd)
 		 * rport is transitioning from blocked/deleted to
 		 * online
 		 */
-		sc_cmd->result = 0;
+		clear_scsi_result(sc_cmd);
 		set_host_byte(sc_cmd, DID_IMM_RETRY);
 		sc_cmd->scsi_done(sc_cmd);
 		goto out;
@@ -2003,7 +2003,7 @@  static void fc_io_compl(struct fc_fcp_pkt *fsp)
 			/*
 			 * good I/O status
 			 */
-			sc_cmd->result = 0;
+			clear_scsi_result(sc_cmd);
 			set_host_byte(sc_cmd, DID_OK);
 			if (fsp->scsi_resid)
 				CMD_RESID_LEN(sc_cmd) = fsp->scsi_resid;
@@ -2018,7 +2018,7 @@  static void fc_io_compl(struct fc_fcp_pkt *fsp)
 	case FC_ERROR:
 		FC_FCP_DBG(fsp, "Returning DID_ERROR to scsi-ml "
 			   "due to FC_ERROR\n");
-		sc_cmd->result = 0;
+		clear_scsi_result(sc_cmd);
 		set_host_byte(sc_cmd, DID_ERROR);
 		break;
 	case FC_DATA_UNDRUN:
@@ -2028,12 +2028,12 @@  static void fc_io_compl(struct fc_fcp_pkt *fsp)
 			 * underrun.
 			 */
 			if (fsp->state & FC_SRB_RCV_STATUS) {
-				sc_cmd->result = 0;
+				clear_scsi_result(sc_cmd);
 				set_host_byte(sc_cmd, DID_OK);
 			} else {
 				FC_FCP_DBG(fsp, "Returning DID_ERROR to scsi-ml"
 					   " due to FC_DATA_UNDRUN (trans)\n");
-				sc_cmd->result = 0;
+				clear_scsi_result(sc_cmd);
 				set_host_byte(sc_cmd, DID_ERROR);
 			}
 		} else {
@@ -2069,25 +2069,25 @@  static void fc_io_compl(struct fc_fcp_pkt *fsp)
 	case FC_CMD_RESET:
 		FC_FCP_DBG(fsp, "Returning DID_RESET to scsi-ml "
 			   "due to FC_CMD_RESET\n");
-		sc_cmd->result = 0;
+		clear_scsi_result(sc_cmd);
 		set_host_byte(sc_cmd, DID_RESET);
 		break;
 	case FC_TRANS_RESET:
 		FC_FCP_DBG(fsp, "Returning DID_SOFT_ERROR to scsi-ml "
 			   "due to FC_TRANS_RESET\n");
-		sc_cmd->result = 0;
+		clear_scsi_result(sc_cmd);
 		set_host_byte(sc_cmd, DID_SOFT_ERROR);
 		break;
 	case FC_HRD_ERROR:
 		FC_FCP_DBG(fsp, "Returning DID_NO_CONNECT to scsi-ml "
 			   "due to FC_HRD_ERROR\n");
-		sc_cmd->result = 0;
+		clear_scsi_result(sc_cmd);
 		set_host_byte(sc_cmd, DID_NO_CONNECT);
 		break;
 	case FC_CRC_ERROR:
 		FC_FCP_DBG(fsp, "Returning DID_PARITY to scsi-ml "
 			   "due to FC_CRC_ERROR\n");
-		sc_cmd->result = 0;
+		clear_scsi_result(sc_cmd);
 		set_host_byte(sc_cmd, DID_PARITY);
 		break;
 	case FC_TIMED_OUT:
@@ -2098,13 +2098,13 @@  static void fc_io_compl(struct fc_fcp_pkt *fsp)
 	default:
 		FC_FCP_DBG(fsp, "Returning DID_ERROR to scsi-ml "
 			   "due to unknown error\n");
-		sc_cmd->result = 0;
+		clear_scsi_result(sc_cmd);
 		set_host_byte(sc_cmd, DID_ERROR);
 		break;
 	}
 
 	if (lport->state != LPORT_ST_READY && fsp->status_code != FC_COMPLETE) {
-		sc_cmd->result = 0;
+		clear_scsi_result(sc_cmd);
 		set_host_byte(sc_cmd, DID_TRANSPORT_DISRUPTED);
 	}
 
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 7d4beae3cf5b..1c12942b98fd 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -636,7 +636,7 @@  static void fail_scsi_task(struct iscsi_task *task, int err)
 	else
 		state = ISCSI_TASK_ABRT_TMF;
 
-	sc->result = 0;
+	clear_scsi_result(sc);
 	set_host_byte(sc, err);
 	if (!scsi_bidi_cmnd(sc))
 		scsi_set_resid(sc, scsi_bufflen(sc));
@@ -857,7 +857,7 @@  static void iscsi_scsi_cmd_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
 
 		ascq = session->tt->check_protection(task, &sector);
 		if (ascq) {
-			sc->result = 0;
+			clear_scsi_result(sc);
 			set_scsi_result(sc, DRIVER_SENSE, 0, 0,
 					SAM_STAT_CHECK_CONDITION);
 			scsi_build_sense_buffer(1, sc->sense_buffer,
@@ -870,7 +870,7 @@  static void iscsi_scsi_cmd_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
 	}
 
 	if (rhdr->response != ISCSI_STATUS_CMD_COMPLETED) {
-		sc->result = 0;
+		clear_scsi_result(sc);
 		set_host_byte(sc, DID_ERROR);
 		goto out;
 	}
@@ -883,7 +883,7 @@  static void iscsi_scsi_cmd_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
 			iscsi_conn_printk(KERN_ERR,  conn,
 					 "Got CHECK_CONDITION but invalid data "
 					 "buffer size of %d\n", datalen);
-			sc->result = 0;
+			clear_scsi_result(sc);
 			set_host_byte(sc, DID_BAD_TARGET);
 			goto out;
 		}
@@ -1679,7 +1679,7 @@  int iscsi_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc)
 	struct iscsi_conn *conn;
 	struct iscsi_task *task = NULL;
 
-	sc->result = 0;
+	clear_scsi_result(sc);
 	sc->SCp.ptr = NULL;
 
 	ihost = shost_priv(host);
@@ -1709,33 +1709,33 @@  int iscsi_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc)
 			 */
 			if (unlikely(system_state != SYSTEM_RUNNING)) {
 				reason = FAILURE_SESSION_FAILED;
-				sc->result = 0;
+				clear_scsi_result(sc);
 				set_host_byte(sc, DID_NO_CONNECT);
 				break;
 			}
 		case ISCSI_STATE_IN_RECOVERY:
 			reason = FAILURE_SESSION_IN_RECOVERY;
-			sc->result = 0;
+			clear_scsi_result(sc);
 			set_host_byte(sc, DID_IMM_RETRY);
 			break;
 		case ISCSI_STATE_LOGGING_OUT:
 			reason = FAILURE_SESSION_LOGGING_OUT;
-			sc->result = 0;
+			clear_scsi_result(sc);
 			set_host_byte(sc, DID_IMM_RETRY);
 			break;
 		case ISCSI_STATE_RECOVERY_FAILED:
 			reason = FAILURE_SESSION_RECOVERY_TIMEOUT;
-			sc->result = 0;
+			clear_scsi_result(sc);
 			set_host_byte(sc, DID_TRANSPORT_FAILFAST);
 			break;
 		case ISCSI_STATE_TERMINATE:
 			reason = FAILURE_SESSION_TERMINATE;
-			sc->result = 0;
+			clear_scsi_result(sc);
 			set_host_byte(sc, DID_NO_CONNECT);
 			break;
 		default:
 			reason = FAILURE_SESSION_FREED;
-			sc->result = 0;
+			clear_scsi_result(sc);
 			set_host_byte(sc, DID_NO_CONNECT);
 		}
 		goto fault;
@@ -1744,14 +1744,14 @@  int iscsi_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc)
 	conn = session->leadconn;
 	if (!conn) {
 		reason = FAILURE_SESSION_FREED;
-		sc->result = 0;
+		clear_scsi_result(sc);
 		set_host_byte(sc, DID_NO_CONNECT);
 		goto fault;
 	}
 
 	if (test_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx)) {
 		reason = FAILURE_SESSION_IN_RECOVERY;
-		sc->result = 0;
+		clear_scsi_result(sc);
 		set_host_byte(sc, DID_REQUEUE);
 		goto fault;
 	}
@@ -1774,7 +1774,7 @@  int iscsi_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc)
 				reason = FAILURE_OOM;
 				goto prepd_reject;
 			} else {
-				sc->result = 0;
+				clear_scsi_result(sc);
 				set_host_byte(sc, DID_ABORT);
 				goto prepd_fault;
 			}
@@ -2011,7 +2011,7 @@  enum blk_eh_timer_return iscsi_eh_cmd_timed_out(struct scsi_cmnd *sc)
 		 * upper layer to deal with the result.
 		 */
 		if (unlikely(system_state != SYSTEM_RUNNING)) {
-			sc->result = 0;
+			clear_scsi_result(sc);
 			set_host_byte(sc, DID_NO_CONNECT);
 			ISCSI_DBG_EH(session, "sc on shutdown, handled\n");
 			rc = BLK_EH_HANDLED;
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index 3da1e550433c..f27a39dec661 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -187,7 +187,7 @@  int sas_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
 
 	/* If the device fell off, no sense in issuing commands */
 	if (test_bit(SAS_DEV_GONE, &dev->state)) {
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_BAD_TARGET);
 		goto out_done;
 	}
@@ -213,11 +213,11 @@  int sas_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
 	ASSIGN_SAS_TASK(cmd, NULL);
 	sas_free_task(task);
 	if (res == -SAS_QUEUE_FULL) {
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_SOFT_ERROR);
 	} /* retry */
 	else {
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_ERROR);
 	}
 out_done:
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index ee23f9a4d4ab..101bce993b3c 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -3017,7 +3017,7 @@  lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd)
 	if (err_type == BGS_GUARD_ERR_MASK) {
 		scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST,
 					0x10, 0x1);
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_scsi_result(cmd, DRIVER_SENSE, DID_ABORT, 0,
 				SAM_STAT_CHECK_CONDITION);
 		phba->bg_guard_err_cnt++;
@@ -3029,7 +3029,7 @@  lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd)
 	} else if (err_type == BGS_REFTAG_ERR_MASK) {
 		scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST,
 					0x10, 0x3);
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_scsi_result(cmd, DRIVER_SENSE, DID_ABORT, 0,
 				SAM_STAT_CHECK_CONDITION);
 
@@ -3042,7 +3042,7 @@  lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd)
 	} else if (err_type == BGS_APPTAG_ERR_MASK) {
 		scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST,
 					0x10, 0x2);
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_scsi_result(cmd, DRIVER_SENSE, DID_ABORT, 0,
 				SAM_STAT_CHECK_CONDITION);
 
@@ -3127,7 +3127,7 @@  lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd,
 
 		scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST,
 				0x10, 0x1);
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_scsi_result(cmd, DRIVER_SENSE, DID_ABORT, 0,
 				SAM_STAT_CHECK_CONDITION);
 		phba->bg_guard_err_cnt++;
@@ -3144,7 +3144,7 @@  lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd,
 
 		scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST,
 				0x10, 0x3);
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_scsi_result(cmd, DRIVER_SENSE, DID_ABORT, 0,
 				SAM_STAT_CHECK_CONDITION);
 		phba->bg_reftag_err_cnt++;
@@ -3161,7 +3161,7 @@  lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd,
 
 		scsi_build_sense_buffer(1, cmd->sense_buffer, ILLEGAL_REQUEST,
 				0x10, 0x2);
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_scsi_result(cmd, DRIVER_SENSE, DID_ABORT, 0,
 				SAM_STAT_CHECK_CONDITION);
 
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index f8cebe02c9c4..fc611836b386 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -586,7 +586,7 @@  mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
 
 		/* have just LUN 0 for each target on virtual channels */
 		if (cmd->device->lun) {
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_BAD_TARGET);
 			cmd->scsi_done(cmd);
 			return NULL;
@@ -606,7 +606,7 @@  mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
 			max_ldrv_num += 0x80;
 
 		if(ldrv_num > max_ldrv_num ) {
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_BAD_TARGET);
 			cmd->scsi_done(cmd);
 			return NULL;
@@ -619,7 +619,7 @@  mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
 			 * Do not support lun >7 for physically accessed
 			 * devices
 			 */
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_BAD_TARGET);
 			cmd->scsi_done(cmd);
 			return NULL;
@@ -640,7 +640,7 @@  mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
 			 * If no, return success always
 			 */
 			if( !adapter->has_cluster ) {
-				cmd->result = 0;
+				clear_scsi_result(cmd);
 				set_host_byte(cmd, DID_OK);
 				cmd->scsi_done(cmd);
 				return NULL;
@@ -659,7 +659,7 @@  mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
 
 			return scb;
 #else
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_OK);
 			cmd->scsi_done(cmd);
 			return NULL;
@@ -675,7 +675,7 @@  mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
 			memset(buf, 0, cmd->cmnd[4]);
 			kunmap_atomic(buf - sg->offset);
 
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_OK);
 			cmd->scsi_done(cmd);
 			return NULL;
@@ -872,7 +872,7 @@  mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
 			 */
 			if( ! adapter->has_cluster ) {
 
-				cmd->result = 0;
+				clear_scsi_result(cmd);
 				set_host_byte(cmd, DID_BAD_TARGET);
 				cmd->scsi_done(cmd);
 				return NULL;
@@ -896,7 +896,7 @@  mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
 #endif
 
 		default:
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_BAD_TARGET);
 			cmd->scsi_done(cmd);
 			return NULL;
@@ -1481,7 +1481,7 @@  mega_cmd_done(adapter_t *adapter, u8 completed[], int nstatus, int status)
 					"aborted cmd [%x] complete\n",
 					scb->idx);
 
-				scb->cmd->result = 0;
+				clear_scsi_result(scb->cmd);
 				set_host_byte(scb->cmd, DID_ABORT);
 
 				list_add_tail(SCSI_LIST(scb->cmd),
@@ -1501,7 +1501,7 @@  mega_cmd_done(adapter_t *adapter, u8 completed[], int nstatus, int status)
 					"reset cmd [%x] complete\n",
 					scb->idx);
 
-				scb->cmd->result = 0;
+				clear_scsi_result(scb->cmd);
 				set_host_byte(scb->cmd, DID_RESET);
 
 				list_add_tail(SCSI_LIST(scb->cmd),
@@ -1576,7 +1576,7 @@  mega_cmd_done(adapter_t *adapter, u8 completed[], int nstatus, int status)
 		}
 
 		/* clear result; otherwise, success returns corrupt value */
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 
 		/* Convert MegaRAID status to Linux error code */
 		switch (status) {
@@ -1999,11 +1999,11 @@  megaraid_abort_and_reset(adapter_t *adapter, struct scsi_cmnd *cmd, int aor)
 				mega_free_scb(adapter, scb);
 
 				if( aor == SCB_ABORT ) {
-					cmd->result = 0;
+					clear_scsi_result(cmd);
 					set_host_byte(cmd, DID_ABORT);
 				}
 				else {
-					cmd->result = 0;
+					clear_scsi_result(cmd);
 					set_host_byte(cmd, DID_RESET);
 				}
 
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c
index 47f4c7f9d5b5..a37ed2a1e47d 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -1463,7 +1463,7 @@  megaraid_queue_command_lck(struct scsi_cmnd *scp, void (*done)(struct scsi_cmnd
 
 	adapter		= SCP2ADAPTER(scp);
 	scp->scsi_done	= done;
-	scp->result	= 0;
+	clear_scsi_result(scp);
 
 	/*
 	 * Allocate and build a SCB request
@@ -1531,13 +1531,13 @@  megaraid_mbox_build_cmd(adapter_t *adapter, struct scsi_cmnd *scp, int *busy)
 			 * If no, return success always
 			 */
 			if (!adapter->ha) {
-				scp->result = 0;
+				clear_scsi_result(scp);
 				set_host_byte(scp, DID_OK);
 				return NULL;
 			}
 
 			if (!(scb = megaraid_alloc_scb(adapter, scp))) {
-				scp->result = 0;
+				clear_scsi_result(scp);
 				set_host_byte(scp, DID_ERROR);
 				*busy = 1;
 				return NULL;
@@ -1575,7 +1575,7 @@  megaraid_mbox_build_cmd(adapter_t *adapter, struct scsi_cmnd *scp, int *busy)
 						 __LINE__));
 			}
 		}
-		scp->result = 0;
+		clear_scsi_result(scp);
 		set_host_byte(scp, DID_OK);
 		return NULL;
 
@@ -1613,12 +1613,12 @@  megaraid_mbox_build_cmd(adapter_t *adapter, struct scsi_cmnd *scp, int *busy)
 			 * requests for more than 40 logical drives
 			 */
 			if (SCP2LUN(scp)) {
-				scp->result = 0;
+				clear_scsi_result(scp);
 				set_host_byte(scp, DID_BAD_TARGET);
 				return NULL;
 			}
 			if ((target % 0x80) >= MAX_LOGICAL_DRIVES_40LD) {
-				scp->result = 0;
+				clear_scsi_result(scp);
 				set_host_byte(scp, DID_BAD_TARGET);
 				return NULL;
 			}
@@ -1626,7 +1626,7 @@  megaraid_mbox_build_cmd(adapter_t *adapter, struct scsi_cmnd *scp, int *busy)
 
 			/* Allocate a SCB and initialize passthru */
 			if (!(scb = megaraid_alloc_scb(adapter, scp))) {
-				scp->result = 0;
+				clear_scsi_result(scp);
 				set_host_byte(scp, DID_ERROR);
 				*busy = 1;
 				return NULL;
@@ -1672,7 +1672,7 @@  megaraid_mbox_build_cmd(adapter_t *adapter, struct scsi_cmnd *scp, int *busy)
 			 * Allocate a SCB and initialize mailbox
 			 */
 			if (!(scb = megaraid_alloc_scb(adapter, scp))) {
-				scp->result = 0;
+				clear_scsi_result(scp);
 				set_host_byte(scp, DID_ERROR);
 				*busy = 1;
 				return NULL;
@@ -1740,7 +1740,7 @@  megaraid_mbox_build_cmd(adapter_t *adapter, struct scsi_cmnd *scp, int *busy)
 
 				megaraid_dealloc_scb(adapter, scb);
 
-				scp->result = 0;
+				clear_scsi_result(scp);
 				set_host_byte(scp, DID_ERROR);
 				return NULL;
 			}
@@ -1762,7 +1762,7 @@  megaraid_mbox_build_cmd(adapter_t *adapter, struct scsi_cmnd *scp, int *busy)
 			 * Do we support clustering and is the support enabled
 			 */
 			if (!adapter->ha) {
-				scp->result = 0;
+				clear_scsi_result(scp);
 				set_host_byte(scp, DID_BAD_TARGET);
 				return NULL;
 			}
@@ -1771,7 +1771,7 @@  megaraid_mbox_build_cmd(adapter_t *adapter, struct scsi_cmnd *scp, int *busy)
 			 * Allocate a SCB and initialize mailbox
 			 */
 			if (!(scb = megaraid_alloc_scb(adapter, scp))) {
-				scp->result = 0;
+				clear_scsi_result(scp);
 				set_host_byte(scp, DID_ERROR);
 				*busy = 1;
 				return NULL;
@@ -1790,7 +1790,7 @@  megaraid_mbox_build_cmd(adapter_t *adapter, struct scsi_cmnd *scp, int *busy)
 			return scb;
 
 		default:
-			scp->result = 0;
+			clear_scsi_result(scp);
 			set_host_byte(scp, DID_BAD_TARGET);
 			return NULL;
 		}
@@ -1799,7 +1799,7 @@  megaraid_mbox_build_cmd(adapter_t *adapter, struct scsi_cmnd *scp, int *busy)
 
 		// Do not allow access to target id > 15 or LUN > 7
 		if (target > 15 || SCP2LUN(scp) > 7) {
-			scp->result = 0;
+			clear_scsi_result(scp);
 			set_host_byte(scp, DID_BAD_TARGET);
 			return NULL;
 		}
@@ -1836,14 +1836,14 @@  megaraid_mbox_build_cmd(adapter_t *adapter, struct scsi_cmnd *scp, int *busy)
 
 		// disable channel sweep if fast load option given
 		if (rdev->fast_load) {
-			scp->result = 0;
+			clear_scsi_result(scp);
 			set_host_byte(scp, DID_BAD_TARGET);
 			return NULL;
 		}
 
 		// Allocate a SCB and initialize passthru
 		if (!(scb = megaraid_alloc_scb(adapter, scp))) {
-			scp->result = 0;
+			clear_scsi_result(scp);
 			set_host_byte(scp, DID_ERROR);
 			*busy = 1;
 			return NULL;
@@ -2349,7 +2349,7 @@  megaraid_mbox_dpc(unsigned long devp)
 
 		case 0x00:
 
-			scp->result = 0;
+			clear_scsi_result(scp);
 			set_host_byte(scp, DID_OK);
 			break;
 
@@ -2488,7 +2488,7 @@  megaraid_abort_handler(struct scsi_cmnd *scp)
 			"megaraid: %d[%d:%d], abort from completed list\n",
 				scb->sno, scb->dev_channel, scb->dev_target));
 
-			scp->result = 0;
+			clear_scsi_result(scp);
 			set_host_byte(scp, DID_ABORT);
 			scp->scsi_done(scp);
 
@@ -2519,7 +2519,7 @@  megaraid_abort_handler(struct scsi_cmnd *scp)
 				"megaraid abort: [%d:%d], driver owner\n",
 				scb->dev_channel, scb->dev_target));
 
-			scp->result = 0;
+			clear_scsi_result(scp);
 			set_host_byte(scp, DID_ABORT);
 			scp->scsi_done(scp);
 
@@ -2642,7 +2642,7 @@  megaraid_reset_handler(struct scsi_cmnd *scp)
 				scb->sno, scb->dev_channel, scb->dev_target));
 			}
 
-			scp->result = 0;
+			clear_scsi_result(scp);
 			set_host_byte(scb->scp, DID_RESET);
 			scb->scp->scsi_done(scb->scp);
 
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 80c7919e4869..1be2743745b3 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -1704,7 +1704,7 @@  megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
 	    scmd->device->host->hostdata;
 
 	if (instance->unload == 1) {
-		scmd->result = 0;
+		clear_scsi_result(scmd);
 		set_host_byte(scmd, DID_NO_CONNECT);
 		scmd->scsi_done(scmd);
 		return 0;
@@ -1720,7 +1720,7 @@  megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
 		    (DID_REQUEUE << 16)) {
 			return SCSI_MLQUEUE_HOST_BUSY;
 		} else {
-			scmd->result = 0;
+			clear_scsi_result(scmd);
 			set_host_byte(scmd, DID_NO_CONNECT);
 			scmd->scsi_done(scmd);
 			return 0;
@@ -1728,7 +1728,7 @@  megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
 	}
 
 	if (atomic_read(&instance->adprecovery) == MEGASAS_HW_CRITICAL_ERROR) {
-		scmd->result = 0;
+		clear_scsi_result(scmd);
 		set_host_byte(scmd, DID_NO_CONNECT);
 		scmd->scsi_done(scmd);
 		return 0;
@@ -1736,7 +1736,7 @@  megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
 
 	mr_device_priv_data = scmd->device->hostdata;
 	if (!mr_device_priv_data) {
-		scmd->result = 0;
+		clear_scsi_result(scmd);
 		set_host_byte(scmd, DID_NO_CONNECT);
 		scmd->scsi_done(scmd);
 		return 0;
@@ -1749,12 +1749,12 @@  megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
 		return SCSI_MLQUEUE_DEVICE_BUSY;
 
 
-	scmd->result = 0;
+	clear_scsi_result(scmd);
 
 	if (MEGASAS_IS_LOGICAL(scmd->device) &&
 	    (scmd->device->id >= instance->fw_supported_vd_count ||
 		scmd->device->lun)) {
-		scmd->result = 0;
+		clear_scsi_result(scmd);
 		set_host_byte(scmd, DID_BAD_TARGET);
 		goto out_done;
 	}
@@ -1762,7 +1762,7 @@  megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
 	if ((scmd->cmnd[0] == SYNCHRONIZE_CACHE) &&
 	    MEGASAS_IS_LOGICAL(scmd->device) &&
 	    (!instance->fw_sync_cache_support)) {
-		scmd->result = 0;
+		clear_scsi_result(scmd);
 		set_host_byte(scmd, DID_OK);
 		goto out_done;
 	}
@@ -2628,7 +2628,7 @@  static int megasas_wait_for_outstanding(struct megasas_instance *instance)
 						struct megasas_cmd, list);
 			list_del_init(&reset_cmd->list);
 			if (reset_cmd->scmd) {
-				reset_cmd->scmd->result = 0;
+				clear_scsi_result(reset_cmd->scmd);
 				set_host_byte(reset_cmd->scmd, DID_REQUEUE);
 				dev_notice(&instance->pdev->dev, "%d:%p reset [%02x]\n",
 					reset_index, reset_cmd,
@@ -3278,7 +3278,7 @@  megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
 	case MFI_CMD_LD_WRITE:
 
 		if (alt_status) {
-			cmd->scmd->result = 0;
+			clear_scsi_result(cmd->scmd);
 			set_host_byte(cmd->scmd, alt_status);
 			exception = 1;
 		}
@@ -3297,7 +3297,7 @@  megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
 		switch (hdr->cmd_status) {
 
 		case MFI_STAT_OK:
-			cmd->scmd->result = 0;
+			clear_scsi_result(cmd->scmd);
 			set_host_byte(cmd->scmd, DID_OK);
 			break;
 
@@ -3325,14 +3325,14 @@  megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
 
 		case MFI_STAT_LD_OFFLINE:
 		case MFI_STAT_DEVICE_NOT_FOUND:
-			cmd->scmd->result = 0;
+			clear_scsi_result(cmd->scmd);
 			set_host_byte(cmd->scmd, DID_BAD_TARGET);
 			break;
 
 		default:
 			dev_printk(KERN_DEBUG, &instance->pdev->dev, "MFI FW status %#x\n",
 			       hdr->cmd_status);
-			cmd->scmd->result = 0;
+			clear_scsi_result(cmd->scmd);
 			set_host_byte(cmd->scmd, DID_ERROR);
 			break;
 		}
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index dccf8af9eb25..2dc5066682dd 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -1779,7 +1779,7 @@  map_cmd_status(struct fusion_context *fusion,
 	switch (status) {
 
 	case MFI_STAT_OK:
-		scmd->result = 0;
+		clear_scsi_result(scmd);
 		set_host_byte(scmd, DID_OK);
 		break;
 
@@ -1818,15 +1818,15 @@  map_cmd_status(struct fusion_context *fusion,
 
 	case MFI_STAT_LD_OFFLINE:
 	case MFI_STAT_DEVICE_NOT_FOUND:
-		scmd->result = 0;
+		clear_scsi_result(scmd);
 		set_host_byte(scmd, DID_BAD_TARGET);
 		break;
 	case MFI_STAT_CONFIG_SEQ_MISMATCH:
-		scmd->result = 0;
+		clear_scsi_result(scmd);
 		set_host_byte(scmd, DID_IMM_RETRY);
 		break;
 	default:
-		scmd->result = 0;
+		clear_scsi_result(scmd);
 		set_host_byte(scmd, DID_ERROR);
 		break;
 	}
@@ -4326,7 +4326,7 @@  int megasas_task_abort_fusion(struct scsi_cmnd *scmd)
 	if (!mr_device_priv_data) {
 		sdev_printk(KERN_INFO, scmd->device, "device been deleted! "
 			"scmd(%p)\n", scmd);
-		scmd->result = 0;
+		clear_scsi_result(scmd);
 		set_host_byte(scmd, DID_NO_CONNECT);
 		ret = SUCCESS;
 		goto out;
@@ -4410,7 +4410,7 @@  int megasas_reset_target_fusion(struct scsi_cmnd *scmd)
 	if (!mr_device_priv_data) {
 		sdev_printk(KERN_INFO, scmd->device, "device been deleted! "
 			"scmd(%p)\n", scmd);
-		scmd->result = 0;
+		clear_scsi_result(scmd);
 		set_host_byte(scmd, DID_NO_CONNECT);
 		ret = SUCCESS;
 		goto out;
diff --git a/drivers/scsi/mesh.c b/drivers/scsi/mesh.c
index fee7ada36d52..c9acfffc202f 100644
--- a/drivers/scsi/mesh.c
+++ b/drivers/scsi/mesh.c
@@ -992,7 +992,7 @@  static void handle_reset(struct mesh_state *ms)
 	for (tgt = 0; tgt < 8; ++tgt) {
 		tp = &ms->tgts[tgt];
 		if ((cmd = tp->current_req) != NULL) {
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_RESET);
 			tp->current_req = NULL;
 			mesh_completed(ms, cmd);
@@ -1003,7 +1003,7 @@  static void handle_reset(struct mesh_state *ms)
 	ms->current_req = NULL;
 	while ((cmd = ms->request_q) != NULL) {
 		ms->request_q = (struct scsi_cmnd *) cmd->host_scribble;
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_RESET);
 		mesh_completed(ms, cmd);
 	}
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index a274970712d3..36f71379c350 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -2839,7 +2839,7 @@  scsih_abort(struct scsi_cmnd *scmd)
 	    ioc->remove_host) {
 		sdev_printk(KERN_INFO, scmd->device,
 			"device been deleted! scmd(%p)\n", scmd);
-		scmd->result = 0;
+		clear_scsi_result(scmd);
 		set_host_byte(scmd, DID_NO_CONNECT);
 		scmd->scsi_done(scmd);
 		r = SUCCESS;
@@ -2848,7 +2848,7 @@  scsih_abort(struct scsi_cmnd *scmd)
 
 	/* check for completed command */
 	if (st == NULL || st->cb_idx == 0xFF) {
-		scmd->result = 0;
+		clear_scsi_result(scmd);
 		set_host_byte(scmd, DID_RESET);
 		r = SUCCESS;
 		goto out;
@@ -2858,7 +2858,7 @@  scsih_abort(struct scsi_cmnd *scmd)
 	if (sas_device_priv_data->sas_target->flags &
 	    MPT_TARGET_FLAGS_RAID_COMPONENT ||
 	    sas_device_priv_data->sas_target->flags & MPT_TARGET_FLAGS_VOLUME) {
-		scmd->result = 0;
+		clear_scsi_result(scmd);
 		set_host_byte(scmd, DID_RESET);
 		r = FAILED;
 		goto out;
@@ -2906,7 +2906,7 @@  scsih_dev_reset(struct scsi_cmnd *scmd)
 	    ioc->remove_host) {
 		sdev_printk(KERN_INFO, scmd->device,
 			"device been deleted! scmd(%p)\n", scmd);
-		scmd->result = 0;
+		clear_scsi_result(scmd);
 		set_host_byte(scmd, DID_NO_CONNECT);
 		scmd->scsi_done(scmd);
 		r = SUCCESS;
@@ -2925,7 +2925,7 @@  scsih_dev_reset(struct scsi_cmnd *scmd)
 		handle = sas_device_priv_data->sas_target->handle;
 
 	if (!handle) {
-		scmd->result = 0;
+		clear_scsi_result(scmd);
 		set_host_byte(scmd, DID_RESET);
 		r = FAILED;
 		goto out;
@@ -2972,7 +2972,7 @@  scsih_target_reset(struct scsi_cmnd *scmd)
 	    ioc->remove_host) {
 		starget_printk(KERN_INFO, starget, "target been deleted! scmd(%p)\n",
 			scmd);
-		scmd->result = 0;
+		clear_scsi_result(scmd);
 		set_host_byte(scmd, DID_NO_CONNECT);
 		scmd->scsi_done(scmd);
 		r = SUCCESS;
@@ -2991,7 +2991,7 @@  scsih_target_reset(struct scsi_cmnd *scmd)
 		handle = sas_device_priv_data->sas_target->handle;
 
 	if (!handle) {
-		scmd->result = 0;
+		clear_scsi_result(scmd);
 		set_host_byte(scmd, DID_RESET);
 		r = FAILED;
 		goto out;
@@ -4464,11 +4464,11 @@  _scsih_flush_running_cmds(struct MPT3SAS_ADAPTER *ioc)
 		mpt3sas_base_clear_st(ioc, st);
 		scsi_dma_unmap(scmd);
 		if (ioc->pci_error_recovery || ioc->remove_host) {
-			scmd->result = 0;
+			clear_scsi_result(scmd);
 			set_host_byte(scmd, DID_NO_CONNECT);
 		}
 		else {
-			scmd->result = 0;
+			clear_scsi_result(scmd);
 			set_host_byte(scmd, DID_RESET);
 		}
 		scmd->scsi_done(scmd);
@@ -4603,14 +4603,14 @@  scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
 
 	sas_device_priv_data = scmd->device->hostdata;
 	if (!sas_device_priv_data || !sas_device_priv_data->sas_target) {
-		scmd->result = 0;
+		clear_scsi_result(scmd);
 		set_host_byte(scmd, DID_NO_CONNECT);
 		scmd->scsi_done(scmd);
 		return 0;
 	}
 
 	if (ioc->pci_error_recovery || ioc->remove_host) {
-		scmd->result = 0;
+		clear_scsi_result(scmd);
 		set_host_byte(scmd, DID_NO_CONNECT);
 		scmd->scsi_done(scmd);
 		return 0;
@@ -4621,7 +4621,7 @@  scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
 	/* invalid device handle */
 	handle = sas_target_priv_data->handle;
 	if (handle == MPT3SAS_INVALID_DEVICE_HANDLE) {
-		scmd->result = 0;
+		clear_scsi_result(scmd);
 		set_host_byte(scmd, DID_NO_CONNECT);
 		scmd->scsi_done(scmd);
 		return 0;
@@ -4634,7 +4634,7 @@  scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
 
 	/* device has been deleted */
 	else if (sas_target_priv_data->deleted) {
-		scmd->result = 0;
+		clear_scsi_result(scmd);
 		set_host_byte(scmd, DID_NO_CONNECT);
 		scmd->scsi_done(scmd);
 		return 0;
@@ -5212,7 +5212,7 @@  _scsih_io_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply)
 	mpi_request = mpt3sas_base_get_msg_frame(ioc, smid);
 
 	if (mpi_reply == NULL) {
-		scmd->result = 0;
+		clear_scsi_result(scmd);
 		set_host_byte(scmd, DID_OK);
 		goto out;
 	}
@@ -5220,7 +5220,7 @@  _scsih_io_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply)
 	sas_device_priv_data = scmd->device->hostdata;
 	if (!sas_device_priv_data || !sas_device_priv_data->sas_target ||
 	     sas_device_priv_data->sas_target->deleted) {
-		scmd->result = 0;
+		clear_scsi_result(scmd);
 		set_host_byte(scmd, DID_NO_CONNECT);
 		goto out;
 	}
@@ -5298,56 +5298,56 @@  _scsih_io_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply)
 	switch (ioc_status) {
 	case MPI2_IOCSTATUS_BUSY:
 	case MPI2_IOCSTATUS_INSUFFICIENT_RESOURCES:
-		scmd->result = 0;
+		clear_scsi_result(scmd);
 		set_status_byte(scmd, SAM_STAT_BUSY);
 		break;
 
 	case MPI2_IOCSTATUS_SCSI_DEVICE_NOT_THERE:
-		scmd->result = 0;
+		clear_scsi_result(scmd);
 		set_host_byte(scmd, DID_NO_CONNECT);
 		break;
 
 	case MPI2_IOCSTATUS_SCSI_IOC_TERMINATED:
 		if (sas_device_priv_data->block) {
-			scmd->result = 0;
+			clear_scsi_result(scmd);
 			set_host_byte(scmd, DID_TRANSPORT_DISRUPTED);
 			goto out;
 		}
 		if (log_info == 0x31110630) {
 			if (scmd->retries > 2) {
-				scmd->result = 0;
+				clear_scsi_result(scmd);
 				set_host_byte(scmd, DID_NO_CONNECT);
 				scsi_device_set_state(scmd->device,
 				    SDEV_OFFLINE);
 			} else {
-				scmd->result = 0;
+				clear_scsi_result(scmd);
 				set_host_byte(scmd, DID_SOFT_ERROR);
 				scmd->device->expecting_cc_ua = 1;
 			}
 			break;
 		} else if (log_info == VIRTUAL_IO_FAILED_RETRY) {
-			scmd->result = 0;
+			clear_scsi_result(scmd);
 			set_host_byte(scmd, DID_RESET);
 			break;
 		} else if ((scmd->device->channel == RAID_CHANNEL) &&
 		   (scsi_state == (MPI2_SCSI_STATE_TERMINATED |
 		   MPI2_SCSI_STATE_NO_SCSI_STATUS))) {
-			scmd->result = 0;
+			clear_scsi_result(scmd);
 			set_host_byte(scmd, DID_RESET);
 			break;
 		}
-		scmd->result = 0;
+		clear_scsi_result(scmd);
 		set_host_byte(scmd, DID_SOFT_ERROR);
 		break;
 	case MPI2_IOCSTATUS_SCSI_TASK_TERMINATED:
 	case MPI2_IOCSTATUS_SCSI_EXT_TERMINATED:
-		scmd->result = 0;
+		clear_scsi_result(scmd);
 		set_host_byte(scmd, DID_RESET);
 		break;
 
 	case MPI2_IOCSTATUS_SCSI_RESIDUAL_MISMATCH:
 		if ((xfer_cnt == 0) || (scmd->underflow > xfer_cnt)) {
-			scmd->result = 0;
+			clear_scsi_result(scmd);
 			set_host_byte(scmd, DID_SOFT_ERROR);
 		}
 		else
@@ -5362,19 +5362,19 @@  _scsih_io_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply)
 
 		if (xfer_cnt < scmd->underflow) {
 			if (scsi_status == SAM_STAT_BUSY) {
-				scmd->result = 0;
+				clear_scsi_result(scmd);
 				set_status_byte(scmd, SAM_STAT_BUSY);
 			} else {
-				scmd->result = 0;
+				clear_scsi_result(scmd);
 				set_host_byte(scmd, DID_SOFT_ERROR);
 			}
 		} else if (scsi_state & (MPI2_SCSI_STATE_AUTOSENSE_FAILED |
 		     MPI2_SCSI_STATE_NO_SCSI_STATUS)) {
-			scmd->result = 0;
+			clear_scsi_result(scmd);
 			set_host_byte(scmd, DID_SOFT_ERROR);
 		}
 		else if (scsi_state & MPI2_SCSI_STATE_TERMINATED) {
-			scmd->result = 0;
+			clear_scsi_result(scmd);
 			set_host_byte(scmd, DID_RESET);
 		}
 		else if (!xfer_cnt && scmd->cmnd[0] == REPORT_LUNS) {
@@ -5398,11 +5398,11 @@  _scsih_io_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply)
 		    MPI2_SCSITASKMGMT_RSP_INVALID_FRAME ||
 		    (scsi_state & (MPI2_SCSI_STATE_AUTOSENSE_FAILED |
 		     MPI2_SCSI_STATE_NO_SCSI_STATUS))) {
-			scmd->result = 0;
+			clear_scsi_result(scmd);
 			set_host_byte(scmd, DID_SOFT_ERROR);
 		}
 		else if (scsi_state & MPI2_SCSI_STATE_TERMINATED) {
-			scmd->result = 0;
+			clear_scsi_result(scmd);
 			set_host_byte(scmd, DID_RESET);
 		}
 		break;
@@ -5423,7 +5423,7 @@  _scsih_io_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply)
 	case MPI2_IOCSTATUS_SCSI_TASK_MGMT_FAILED:
 	case MPI2_IOCSTATUS_INSUFFICIENT_POWER:
 	default:
-		scmd->result = 0;
+		clear_scsi_result(scmd);
 		set_host_byte(scmd, DID_SOFT_ERROR);
 		break;
 
diff --git a/drivers/scsi/mvumi.c b/drivers/scsi/mvumi.c
index 9cf3c83d9f08..866706fa9a4a 100644
--- a/drivers/scsi/mvumi.c
+++ b/drivers/scsi/mvumi.c
@@ -2105,7 +2105,7 @@  static int mvumi_queue_command(struct Scsi_Host *shost,
 	scsi_cmd_get_serial(shost, scmd);
 
 	mhba = (struct mvumi_hba *) shost->hostdata;
-	scmd->result = 0;
+	clear_scsi_result(scmd);
 	cmd = mvumi_get_cmd(mhba);
 	if (unlikely(!cmd)) {
 		spin_unlock_irqrestore(shost->host_lock, irq_flags);
diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
index d89b14739ac4..9374620ab329 100644
--- a/drivers/scsi/nsp32.c
+++ b/drivers/scsi/nsp32.c
@@ -470,7 +470,7 @@  static int nsp32_selection_autopara(struct scsi_cmnd *SCpnt)
 	if (phase != BUSMON_BUS_FREE) {
 		nsp32_msg(KERN_WARNING, "bus busy");
 		show_busphase(phase & BUSMON_PHASE_MASK);
-		SCpnt->result = 0;
+		clear_scsi_result(SCpnt);
 		set_host_byte(SCpnt, DID_BUS_BUSY);
 		return FALSE;
 	}
@@ -483,7 +483,7 @@  static int nsp32_selection_autopara(struct scsi_cmnd *SCpnt)
 	 */
 	if (data->msgout_len == 0) {
 		nsp32_msg(KERN_ERR, "SCSI MsgOut without any message!");
-		SCpnt->result = 0;
+		clear_scsi_result(SCpnt);
 		set_host_byte(SCpnt, DID_ERROR);
 		return FALSE;
 	} else if (data->msgout_len > 0 && data->msgout_len <= 3) {
@@ -608,7 +608,7 @@  static int nsp32_selection_autoscsi(struct scsi_cmnd *SCpnt)
 	phase = nsp32_read1(base, SCSI_BUS_MONITOR);
 	if ((phase & BUSMON_BSY) || (phase & BUSMON_SEL)) {
 		nsp32_msg(KERN_WARNING, "bus busy");
-		SCpnt->result = 0;
+		clear_scsi_result(SCpnt);
 		set_host_byte(SCpnt, DID_BUS_BUSY);
 		status = 1;
 		goto out;
@@ -645,7 +645,7 @@  static int nsp32_selection_autoscsi(struct scsi_cmnd *SCpnt)
 	 */
 	if (data->msgout_len == 0) {
 		nsp32_msg(KERN_ERR, "SCSI MsgOut without any message!");
-		SCpnt->result = 0;
+		clear_scsi_result(SCpnt);
 		set_host_byte(SCpnt, DID_ERROR);
 		status = 1;
 		goto out;
@@ -776,12 +776,12 @@  static int nsp32_arbitration(struct scsi_cmnd *SCpnt, unsigned int base)
 
 	if (arbit & ARBIT_WIN) {
 		/* Arbitration succeeded */
-		SCpnt->result = 0;
+		clear_scsi_result(SCpnt);
 		set_host_byte(SCpnt, DID_OK);
 		nsp32_index_write1(base, EXT_PORT, LED_ON); /* PCI LED on */
 	} else if (arbit & ARBIT_FAIL) {
 		/* Arbitration failed */
-		SCpnt->result = 0;
+		clear_scsi_result(SCpnt);
 		set_host_byte(SCpnt, DID_BUS_BUSY);
 		status = FALSE;
 	} else {
@@ -790,7 +790,7 @@  static int nsp32_arbitration(struct scsi_cmnd *SCpnt, unsigned int base)
 		 * something lock up! guess no connection.
 		 */
 		nsp32_dbg(NSP32_DEBUG_AUTOSCSI, "arbit timeout");
-		SCpnt->result = 0;
+		clear_scsi_result(SCpnt);
 		set_host_byte(SCpnt, DID_NO_CONNECT);
 		status = FALSE;
         }
@@ -927,7 +927,7 @@  static int nsp32_queuecommand_lck(struct scsi_cmnd *SCpnt, void (*done)(struct s
 	if (data->CurrentSC != NULL) {
 		nsp32_msg(KERN_ERR, "Currentsc != NULL. Cancel this command request");
 		data->CurrentSC = NULL;
-		SCpnt->result = 0;
+		clear_scsi_result(SCpnt);
 		set_host_byte(SCpnt, DID_NO_CONNECT);
 		done(SCpnt);
 		return 0;
@@ -936,7 +936,7 @@  static int nsp32_queuecommand_lck(struct scsi_cmnd *SCpnt, void (*done)(struct s
 	/* check target ID is not same as this initiator ID */
 	if (scmd_id(SCpnt) == SCpnt->device->host->this_id) {
 		nsp32_dbg(NSP32_DEBUG_QUEUECOMMAND, "target==host???");
-		SCpnt->result = 0;
+		clear_scsi_result(SCpnt);
 		set_host_byte(SCpnt, DID_BAD_TARGET);
 		done(SCpnt);
 		return 0;
@@ -945,7 +945,7 @@  static int nsp32_queuecommand_lck(struct scsi_cmnd *SCpnt, void (*done)(struct s
 	/* check target LUN is allowable value */
 	if (SCpnt->device->lun >= MAX_LUN) {
 		nsp32_dbg(NSP32_DEBUG_QUEUECOMMAND, "no more lun");
-		SCpnt->result = 0;
+		clear_scsi_result(SCpnt);
 		set_host_byte(SCpnt, DID_BAD_TARGET);
 		done(SCpnt);
 		return 0;
@@ -978,7 +978,7 @@  static int nsp32_queuecommand_lck(struct scsi_cmnd *SCpnt, void (*done)(struct s
 	ret = nsp32_setup_sg_table(SCpnt);
 	if (ret == FALSE) {
 		nsp32_msg(KERN_ERR, "SGT fail");
-		SCpnt->result = 0;
+		clear_scsi_result(SCpnt);
 		set_host_byte(SCpnt, DID_ERROR);
 		nsp32_scsi_done(SCpnt);
 		return 0;
@@ -1202,7 +1202,7 @@  static irqreturn_t do_nsp32_isr(int irq, void *dev_id)
 		nsp32_msg(KERN_INFO, "card disconnect");
 		if (data->CurrentSC != NULL) {
 			nsp32_msg(KERN_INFO, "clean up current SCSI command");
-			SCpnt->result = 0;
+			clear_scsi_result(SCpnt);
 			set_host_byte(SCpnt, DID_BAD_TARGET);
 			nsp32_scsi_done(SCpnt);
 		}
@@ -1221,7 +1221,7 @@  static irqreturn_t do_nsp32_isr(int irq, void *dev_id)
 		nsp32_msg(KERN_INFO, "detected someone do bus reset");
 		nsp32_do_bus_reset(data);
 		if (SCpnt != NULL) {
-			SCpnt->result = 0;
+			clear_scsi_result(SCpnt);
 			set_host_byte(SCpnt, DID_RESET);
 			nsp32_scsi_done(SCpnt);
 		}
@@ -1250,7 +1250,7 @@  static irqreturn_t do_nsp32_isr(int irq, void *dev_id)
 			nsp32_dbg(NSP32_DEBUG_INTR,
 				  "selection timeout occurred");
 
-			SCpnt->result = 0;
+			clear_scsi_result(SCpnt);
 			set_host_byte(SCpnt, DID_TIME_OUT);
 			nsp32_scsi_done(SCpnt);
 			goto out;
@@ -1711,7 +1711,7 @@  static int nsp32_busfree_occur(struct scsi_cmnd *SCpnt, unsigned short execph)
 		nsp32_msg(KERN_WARNING, "unexpected bus free occurred");
 
 		/* DID_ERROR? */
-		SCpnt->result = 0;
+		clear_scsi_result(SCpnt);
 		set_host_byte(SCpnt, DID_ERROR);
 		nsp32_scsi_done(SCpnt);
 		return TRUE;
@@ -2849,7 +2849,7 @@  static int nsp32_eh_abort(struct scsi_cmnd *SCpnt)
 	nsp32_write2(base, TRANSFER_CONTROL, 0);
 	nsp32_write2(base, BM_CNT,           0);
 
-	SCpnt->result = 0;
+	clear_scsi_result(SCpnt);
 	set_host_byte(SCpnt, DID_ABORT);
 	nsp32_scsi_done(SCpnt);
 
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index 2fe99aa08396..500bb2b092aa 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -203,7 +203,7 @@  static int nsp_queuecommand_lck(struct scsi_cmnd *SCpnt,
 
 	if (data->CurrentSC != NULL) {
 		nsp_msg(KERN_DEBUG, "CurrentSC!=NULL this can't be happen");
-		SCpnt->result = 0;
+		clear_scsi_result(SCpnt);
 		set_host_byte(SCpnt, DID_BAD_TARGET);
 		nsp_scsi_done(SCpnt);
 		return 0;
@@ -251,7 +251,7 @@  static int nsp_queuecommand_lck(struct scsi_cmnd *SCpnt,
 
 	if (nsphw_start_selection(SCpnt) == FALSE) {
 		nsp_dbg(NSP_DEBUG_QUEUECOMMAND, "selection fail");
-		SCpnt->result = 0;
+		clear_scsi_result(SCpnt);
 		set_host_byte(SCpnt, DID_BUS_BUSY);
 		nsp_scsi_done(SCpnt);
 		return 0;
@@ -1086,7 +1086,7 @@  static irqreturn_t nspintr(int irq, void *dev_id)
 				data->SelectionTimeOut = 0;
 				nsp_index_write(base, SCSIBUSCTRL, 0);
 
-				tmpSC->result = 0;
+				clear_scsi_result(tmpSC);
 				set_host_byte(tmpSC, DID_TIME_OUT);
 				nsp_scsi_done(tmpSC);
 
@@ -1113,7 +1113,7 @@  static irqreturn_t nspintr(int irq, void *dev_id)
 		// *sync_neg = SYNC_NOT_YET;
 		if ((phase & BUSMON_PHASE_MASK) != BUSPHASE_MESSAGE_IN) {
 
-			tmpSC->result = 0;
+			clear_scsi_result(tmpSC);
 			set_host_byte(tmpSC, DID_ABORT);
 			nsp_scsi_done(tmpSC);
 			return IRQ_HANDLED;
@@ -1157,7 +1157,7 @@  static irqreturn_t nspintr(int irq, void *dev_id)
 		nsp_msg(KERN_DEBUG, "unexpected bus free. irq_status=0x%x, phase=0x%x, irq_phase=0x%x", irq_status, phase, irq_phase);
 
 		*sync_neg       = SYNC_NG;
-		tmpSC->result = 0;
+		clear_scsi_result(tmpSC);
 		set_host_byte(tmpSC, DID_ERROR);
 		nsp_scsi_done(tmpSC);
 		return IRQ_HANDLED;
diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c
index 77ca5002445a..b558c919258f 100644
--- a/drivers/scsi/pcmcia/sym53c500_cs.c
+++ b/drivers/scsi/pcmcia/sym53c500_cs.c
@@ -382,28 +382,28 @@  SYM53C500_intr(int irq, void *dev_id)
 
 	if (int_reg & 0x80) {	/* SCSI reset intr */
 		DEB(printk("SYM53C500: reset intr received\n"));
-		curSC->result = 0;
+		clear_scsi_result(curSC);
 		set_host_byte(curSC, DID_RESET);
 		goto idle_out;
 	}
 
 	if (pio_status & 0x80) {
 		printk("SYM53C500: Warning: PIO error!\n");
-		curSC->result = 0;
+		clear_scsi_result(curSC);
 		set_host_byte(curSC, DID_ERROR);
 		goto idle_out;
 	}
 
 	if (status & 0x20) {		/* Parity error */
 		printk("SYM53C500: Warning: parity error!\n");
-		curSC->result = 0;
+		clear_scsi_result(curSC);
 		set_host_byte(curSC, DID_PARITY);
 		goto idle_out;
 	}
 
 	if (status & 0x40) {		/* Gross error */
 		printk("SYM53C500: Warning: gross error!\n");
-		curSC->result = 0;
+		clear_scsi_result(curSC);
 		set_host_byte(curSC, DID_ERROR);
 		goto idle_out;
 	}
@@ -411,7 +411,7 @@  SYM53C500_intr(int irq, void *dev_id)
 	if (int_reg & 0x20) {		/* Disconnect */
 		DEB(printk("SYM53C500: disconnect intr received\n"));
 		if (curSC->SCp.phase != message_in) {	/* Unexpected disconnect */
-			curSC->result = 0;
+			clear_scsi_result(curSC);
 			set_host_byte(curSC, DID_NO_CONNECT);
 		} else {	/* Command complete, return status and message */
 			set_scsi_result(curSC, 0, DID_OK, 0,
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index 91ffbf6977b4..af751bb45ddf 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -3363,7 +3363,7 @@  static int pmcraid_queuecommand_lck(
 	fw_version = be16_to_cpu(pinstance->inq_data->fw_version);
 	scsi_cmd->scsi_done = done;
 	res = scsi_cmd->device->hostdata;
-	scsi_cmd->result = 0;
+	clear_scsi_result(scsi_cmd);
 	set_host_byte(scsi_cmd, DID_OK);
 
 	/* if adapter is marked as dead, set result to DID_NO_CONNECT complete
@@ -3371,7 +3371,7 @@  static int pmcraid_queuecommand_lck(
 	 */
 	if (pinstance->ioa_state == IOA_STATE_DEAD) {
 		pmcraid_info("IOA is dead, but queuecommand is scheduled\n");
-		scsi_cmd->result = 0;
+		clear_scsi_result(scsi_cmd);
 		set_host_byte(scsi_cmd, DID_NO_CONNECT);
 		scsi_cmd->scsi_done(scsi_cmd);
 		return 0;
diff --git a/drivers/scsi/ppa.c b/drivers/scsi/ppa.c
index e531af3f47a9..5ac8f8de7989 100644
--- a/drivers/scsi/ppa.c
+++ b/drivers/scsi/ppa.c
@@ -164,7 +164,7 @@  static inline void ppa_fail(ppa_struct *dev, int error_code)
 {
 	/* If we fail a device then we trash status / message bytes */
 	if (dev->cur_cmd) {
-		dev->cur_cmd->result = 0;
+		clear_scsi_result(dev->cur_cmd);
 		set_host_byte(dev->cur_cmd, error_code);
 		dev->failed = 1;
 	}
@@ -765,7 +765,7 @@  static int ppa_engine(ppa_struct *dev, struct scsi_cmnd *cmd)
 		/* fall through */
 
 	case 6:		/* Phase 6 - Read status/message */
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_OK);
 		/* Check for data overrun */
 		if (ppa_wait(dev) != (unsigned char) 0xf0) {
@@ -800,7 +800,7 @@  static int ppa_queuecommand_lck(struct scsi_cmnd *cmd,
 	dev->jstart = jiffies;
 	dev->cur_cmd = cmd;
 	cmd->scsi_done = done;
-	cmd->result = 0;
+	clear_scsi_result(cmd);
 	set_host_byte(cmd, DID_ERROR);	/* default return code */
 	cmd->SCp.phase = 0;	/* bus free */
 
diff --git a/drivers/scsi/ps3rom.c b/drivers/scsi/ps3rom.c
index edbd95f5db0b..fad2674c1bd6 100644
--- a/drivers/scsi/ps3rom.c
+++ b/drivers/scsi/ps3rom.c
@@ -314,7 +314,7 @@  static irqreturn_t ps3rom_interrupt(int irq, void *data)
 
 			scsi_set_resid(cmd, scsi_bufflen(cmd) - len);
 		}
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_OK);
 		goto done;
 	}
@@ -329,7 +329,7 @@  static irqreturn_t ps3rom_interrupt(int irq, void *data)
 	}
 
 	if (decode_lv1_status(status, &sense_key, &asc, &ascq)) {
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_ERROR);
 		goto done;
 	}
diff --git a/drivers/scsi/qedf/qedf_io.c b/drivers/scsi/qedf/qedf_io.c
index b05811064133..045c85d922be 100644
--- a/drivers/scsi/qedf/qedf_io.c
+++ b/drivers/scsi/qedf/qedf_io.c
@@ -926,7 +926,7 @@  qedf_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc_cmd)
 
 	if (test_bit(QEDF_UNLOADING, &qedf->flags) ||
 	    test_bit(QEDF_DBG_STOP_IO, &qedf->flags)) {
-		sc_cmd->result = 0;
+		clear_scsi_result(sc_cmd);
 		set_host_byte(sc_cmd, DID_NO_CONNECT);
 		sc_cmd->scsi_done(sc_cmd);
 		return 0;
@@ -1125,7 +1125,7 @@  void qedf_scsi_completion(struct qedf_ctx *qedf, struct fcoe_cqe *cqe,
 		    "FCP I/O protocol failure xid=0x%x fcp_rsp_len=%d "
 		    "fcp_rsp_code=%d.\n", io_req->xid, io_req->fcp_rsp_len,
 		    io_req->fcp_rsp_code);
-		sc_cmd->result = 0;
+		clear_scsi_result(sc_cmd);
 		set_host_byte(sc_cmd, DID_BUS_BUSY);
 		goto out;
 	}
@@ -1167,7 +1167,7 @@  void qedf_scsi_completion(struct qedf_ctx *qedf, struct fcoe_cqe *cqe,
 	case FC_GOOD:
 		if (io_req->cdb_status == 0) {
 			/* Good I/O completion */
-			sc_cmd->result = 0;
+			clear_scsi_result(sc_cmd);
 			set_host_byte(sc_cmd, DID_OK);
 		} else {
 			refcount = kref_read(&io_req->refcount);
@@ -1255,7 +1255,7 @@  void qedf_scsi_done(struct qedf_ctx *qedf, struct qedf_ioreq *io_req,
 
 	qedf_unmap_sg_list(qedf, io_req);
 
-	sc_cmd->result = 0;
+	clear_scsi_result(sc_cmd);
 	set_host_byte(sc_cmd, result);
 	refcount = kref_read(&io_req->refcount);
 	QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_IO, "%d:0:%d:%lld: Completing "
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
index 9c1418cf9f6d..c69410da536b 100644
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -3476,7 +3476,7 @@  qla1280_isr(struct scsi_qla_host *ha, struct list_head *done_q)
 					ha->outstanding_cmds[index] = NULL;
 
 					/* Save ISP completion status */
-					CMD_RESULT(sp->cmd) = 0;
+					clear_scsi_result(sp->cmd);
 					CMD_HANDLE(sp->cmd) = COMPLETED_HANDLE;
 
 					/* Place block on done queue */
diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
index 5e9c2f81c5f6..4b6f865e0498 100644
--- a/drivers/scsi/qla2xxx/qla_iocb.c
+++ b/drivers/scsi/qla2xxx/qla_iocb.c
@@ -1930,14 +1930,14 @@  qla2xxx_dif_start_scsi_mq(srb_t *sp)
 
 	/* Check for host side state */
 	if (!qpair->online) {
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_NO_CONNECT);
 		return QLA_INTERFACE_ERROR;
 	}
 
 	if (!qpair->difdix_supported &&
 		scsi_get_prot_op(cmd) != SCSI_PROT_NORMAL) {
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_NO_CONNECT);
 		return QLA_INTERFACE_ERROR;
 	}
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 8370ca5b2bf9..6b247c7cbeab 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -2129,7 +2129,7 @@  qla2x00_handle_dif_error(srb_t *sp, struct sts_entry_24xx *sts24)
 		    cmd->device->sector_size);
 
 		scsi_set_resid(cmd, resid);
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_OK);
 
 		/* Update protection tag */
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 5dea2a3b0e37..1757045901a5 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -847,7 +847,7 @@  qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
 	uint16_t hwq;
 
 	if (unlikely(test_bit(UNLOADING, &base_vha->dpc_flags))) {
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_NO_CONNECT);
 		goto qc24_fail_command;
 	}
@@ -870,12 +870,12 @@  qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
 			ql_dbg(ql_dbg_aer, vha, 0x9010,
 			    "PCI Channel IO permanent failure, exiting "
 			    "cmd=%p.\n", cmd);
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_NO_CONNECT);
 		} else {
 			ql_dbg(ql_dbg_aer, vha, 0x9011,
 			    "EEH_Busy, Requeuing the cmd=%p.\n", cmd);
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_REQUEUE);
 		}
 		goto qc24_fail_command;
@@ -895,13 +895,13 @@  qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
 			ql_dbg(ql_dbg_io, vha, 0x3004,
 			    "DIF Cap not reg, fail DIF capable cmd's:%p.\n",
 			    cmd);
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_NO_CONNECT);
 			goto qc24_fail_command;
 	}
 
 	if (!fcport) {
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_NO_CONNECT);
 		goto qc24_fail_command;
 	}
@@ -913,7 +913,7 @@  qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
 			    "Returning DNC, fcport_state=%d loop_state=%d.\n",
 			    atomic_read(&fcport->state),
 			    atomic_read(&base_vha->loop_state));
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_NO_CONNECT);
 			goto qc24_fail_command;
 		}
@@ -989,7 +989,7 @@  qla2xxx_mqueuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd,
 	}
 
 	if (!fcport) {
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_NO_CONNECT);
 		goto qc24_fail_command;
 	}
@@ -1001,7 +1001,7 @@  qla2xxx_mqueuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd,
 			    "Returning DNC, fcport_state=%d loop_state=%d.\n",
 			    atomic_read(&fcport->state),
 			    atomic_read(&base_vha->loop_state));
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_NO_CONNECT);
 			goto qc24_fail_command;
 		}
diff --git a/drivers/scsi/qla4xxx/ql4_isr.c b/drivers/scsi/qla4xxx/ql4_isr.c
index 558a1727b827..b30805064038 100644
--- a/drivers/scsi/qla4xxx/ql4_isr.c
+++ b/drivers/scsi/qla4xxx/ql4_isr.c
@@ -146,7 +146,7 @@  static void qla4xxx_status_entry(struct scsi_qla_host *ha,
 
 	ddb_entry = srb->ddb;
 	if (ddb_entry == NULL) {
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_NO_CONNECT);
 		goto status_entry_exit;
 	}
@@ -159,7 +159,7 @@  static void qla4xxx_status_entry(struct scsi_qla_host *ha,
 	case SCS_COMPLETE:
 
 		if (sts_entry->iscsiFlags & ISCSI_FLAG_RESIDUAL_OVER) {
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_ERROR);
 			break;
 		}
@@ -169,7 +169,7 @@  static void qla4xxx_status_entry(struct scsi_qla_host *ha,
 			if (!scsi_status && ((scsi_bufflen(cmd) - residual) <
 				cmd->underflow)) {
 
-				cmd->result = 0;
+				clear_scsi_result(cmd);
 				set_host_byte(cmd, DID_ERROR);
 
 				DEBUG2(printk("scsi%ld:%d:%d:%llu: %s: "
@@ -196,7 +196,7 @@  static void qla4xxx_status_entry(struct scsi_qla_host *ha,
 	case SCS_INCOMPLETE:
 		/* Always set the status to DID_ERROR, since
 		 * all conditions result in that status anyway */
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_ERROR);
 		break;
 
@@ -205,7 +205,7 @@  static void qla4xxx_status_entry(struct scsi_qla_host *ha,
 			      ha->host_no, cmd->device->channel,
 			      cmd->device->id, cmd->device->lun, __func__));
 
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_RESET);
 		break;
 
@@ -214,7 +214,7 @@  static void qla4xxx_status_entry(struct scsi_qla_host *ha,
 			      ha->host_no, cmd->device->channel,
 			      cmd->device->id, cmd->device->lun, __func__));
 
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_RESET);
 		break;
 
@@ -223,7 +223,7 @@  static void qla4xxx_status_entry(struct scsi_qla_host *ha,
 			      ha->host_no, cmd->device->channel,
 			      cmd->device->id, cmd->device->lun));
 
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_TRANSPORT_DISRUPTED);
 
 		/*
@@ -244,7 +244,7 @@  static void qla4xxx_status_entry(struct scsi_qla_host *ha,
 				      cmd->device->channel, cmd->device->id,
 				      cmd->device->lun, __func__));
 
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_ERROR);
 			break;
 		}
@@ -275,7 +275,7 @@  static void qla4xxx_status_entry(struct scsi_qla_host *ha,
 						   scsi_bufflen(cmd),
 						   residual));
 
-				cmd->result = 0;
+				clear_scsi_result(cmd);
 				set_host_byte(cmd, DID_ERROR);
 				break;
 			}
@@ -334,7 +334,7 @@  static void qla4xxx_status_entry(struct scsi_qla_host *ha,
 		if (iscsi_is_session_online(ddb_entry->sess))
 			qla4xxx_mark_device_missing(ddb_entry->sess);
 
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_TRANSPORT_DISRUPTED);
 		break;
 
@@ -354,7 +354,7 @@  static void qla4xxx_status_entry(struct scsi_qla_host *ha,
 		break;
 
 	default:
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_ERROR);
 		break;
 	}
@@ -541,7 +541,7 @@  void qla4xxx_process_response_queue(struct scsi_qla_host *ha)
 
 			/* ETRY normally by sending it back with
 			 * DID_BUS_BUSY */
-			srb->cmd->result = 0;
+			clear_scsi_result(srb->cmd);
 			set_host_byte(srb->cmd, DID_BUS_BUSY);
 			kref_put(&srb->srb_ref, qla4xxx_srb_compl);
 			break;
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index ee9cbe4e6416..0992e59b7d34 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -4079,18 +4079,18 @@  static int qla4xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
 
 	if (test_bit(AF_EEH_BUSY, &ha->flags)) {
 		if (test_bit(AF_PCI_CHANNEL_IO_PERM_FAILURE, &ha->flags)) {
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_NO_CONNECT);
 		}
 		else {
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_REQUEUE);
 		}
 		goto qc_fail_command;
 	}
 
 	if (!sess) {
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_IMM_RETRY);
 		goto qc_fail_command;
 	}
diff --git a/drivers/scsi/qlogicfas408.c b/drivers/scsi/qlogicfas408.c
index 1ed5800ccad7..8c706430acee 100644
--- a/drivers/scsi/qlogicfas408.c
+++ b/drivers/scsi/qlogicfas408.c
@@ -444,7 +444,7 @@  static int qlogicfas408_queuecommand_lck(struct scsi_cmnd *cmd,
 {
 	struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd);
 	if (scmd_id(cmd) == priv->qinitid) {
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_BAD_TARGET);
 		done(cmd);
 		return 0;
diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c
index f1ea69109361..16997404c1f3 100644
--- a/drivers/scsi/qlogicpti.c
+++ b/drivers/scsi/qlogicpti.c
@@ -1172,7 +1172,7 @@  static struct scsi_cmnd *qlogicpti_intr_handler(struct qlogicpti *qpti)
 			Cmnd->result =
 			    qlogicpti_return_status(sts, qpti->qpti_id);
 		else {
-			Cmnd->result = 0;
+			clear_scsi_result(Cmnd);
 			set_host_byte(Cmnd, DID_ERROR);
 		}
 
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 9955b05121f5..33069cd3bd3b 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -959,7 +959,7 @@  void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd, struct scsi_eh_save *ses,
 	memset(scmd->cmnd, 0, BLK_MAX_CDB);
 	memset(&scmd->sdb, 0, sizeof(scmd->sdb));
 	scmd->request->next_rq = NULL;
-	scmd->result = 0;
+	clear_scsi_result(scmd);
 
 	if (sense_bytes) {
 		scmd->sdb.length = min_t(unsigned, SCSI_SENSE_BUFFERSIZE,
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 81de52a1557f..69420eb6d68d 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -189,7 +189,7 @@  static void __scsi_queue_insert(struct scsi_cmnd *cmd, int reason, bool unbusy)
 	 * lock such that the kblockd_schedule_work() call happens
 	 * before blk_cleanup_queue() finishes.
 	 */
-	cmd->result = 0;
+	clear_scsi_result(cmd);
 	if (q->mq_ops) {
 		/*
 		 * Before a SCSI command is dispatched,
@@ -1639,7 +1639,7 @@  static void scsi_kill_request(struct request *req, struct request_queue *q)
 	starget = scsi_target(sdev);
 	shost = sdev->host;
 	scsi_init_cmd_errh(cmd);
-	cmd->result = 0;
+	clear_scsi_result(cmd);
 	set_host_byte(cmd, DID_NO_CONNECT);
 	atomic_inc(&cmd->device->iorequest_cnt);
 
@@ -1714,7 +1714,7 @@  static int scsi_dispatch_cmd(struct scsi_cmnd *cmd)
 		/* in SDEV_DEL we error all commands. DID_NO_CONNECT
 		 * returns an immediate error upwards, and signals
 		 * that the device is no longer present */
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_NO_CONNECT);
 		goto done;
 	}
@@ -1749,13 +1749,13 @@  static int scsi_dispatch_cmd(struct scsi_cmnd *cmd)
 			       "queuecommand : command too long. "
 			       "cdb_size=%d host->max_cmd_len=%d\n",
 			       cmd->cmd_len, cmd->device->host->max_cmd_len));
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_ABORT);
 		goto done;
 	}
 
 	if (unlikely(host->shost_state == SHOST_DEL)) {
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_NO_CONNECT);
 		goto done;
 
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index a6201e696ab9..ae689877528c 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2003,7 +2003,7 @@  static int sd_done(struct scsi_cmnd *SCpnt)
 		 * unknown amount of data was transferred so treat it as an
 		 * error.
 		 */
-		SCpnt->result = 0;
+		clear_scsi_result(SCpnt);
 		memset(SCpnt->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
 		break;
 	case ABORTED_COMMAND:
diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index 5ef2ecbe75ec..6c224d4f0d24 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -4714,7 +4714,7 @@  static void pqi_queue_raid_bypass_retry(struct pqi_io_request *io_request)
 
 	io_request->io_complete_callback = pqi_queued_raid_bypass_complete;
 	scmd = io_request->scmd;
-	scmd->result = 0;
+	clear_scsi_result(scmd);
 	ctrl_info = shost_to_hba(scmd->device->host);
 
 	pqi_add_to_raid_bypass_retry_list(ctrl_info, io_request, false);
@@ -4958,7 +4958,7 @@  static int pqi_scsi_queue_command(struct Scsi_Host *shost,
 	 * This is necessary because the SML doesn't zero out this field during
 	 * error recovery.
 	 */
-	scmd->result = 0;
+	clear_scsi_result(scmd);
 
 	hw_queue = pqi_get_hw_queue(ctrl_info, scmd);
 	queue_group = &ctrl_info->queue_groups[hw_queue];
diff --git a/drivers/scsi/snic/snic_scsi.c b/drivers/scsi/snic/snic_scsi.c
index 2b000a7d37de..1b1a8f020687 100644
--- a/drivers/scsi/snic/snic_scsi.c
+++ b/drivers/scsi/snic/snic_scsi.c
@@ -847,7 +847,7 @@  snic_process_itmf_cmpl(struct snic *snic,
 		}
 
 		CMD_SP(sc) = NULL;
-		sc->result = 0;
+		clear_scsi_result(sc);
 		set_host_byte(sc, DID_ERROR);
 		SNIC_SCSI_DBG(snic->shost,
 			      "itmf_cmpl: Completing IO. sc %p flags 0x%llx\n",
@@ -1480,7 +1480,7 @@  snic_abort_finish(struct snic *snic, struct scsi_cmnd *sc)
 		 * the # IO timeouts == 2, will cause the LUN offline.
 		 * Call scsi_done to complete the IO.
 		 */
-		sc->result = 0;
+		clear_scsi_result(sc);
 		set_host_byte(sc, DID_ERROR);
 		sc->scsi_done(sc);
 		break;
@@ -1861,7 +1861,7 @@  snic_dr_clean_single_req(struct snic *snic,
 
 	snic_release_req_buf(snic, rqi, sc);
 
-	sc->result = 0;
+	clear_scsi_result(sc);
 	set_host_byte(sc, DID_ERROR);
 	sc->scsi_done(sc);
 
@@ -2499,7 +2499,7 @@  snic_scsi_cleanup(struct snic *snic, int ex_tag)
 		snic_release_req_buf(snic, rqi, sc);
 
 cleanup:
-		sc->result = 0;
+		clear_scsi_result(sc);
 		set_host_byte(sc, DID_TRANSPORT_DISRUPTED);
 		SNIC_HOST_INFO(snic->shost,
 			       "sc_clean: DID_TRANSPORT_DISRUPTED for sc %p, Tag %d flags 0x%llx rqi %p duration %u msecs\n",
diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
index ab816d1809ae..094f98650884 100644
--- a/drivers/scsi/stex.c
+++ b/drivers/scsi/stex.c
@@ -581,7 +581,7 @@  static void return_abnormal_state(struct st_hba *hba, int status)
 		ccb->req = NULL;
 		if (ccb->cmd) {
 			scsi_dma_unmap(ccb->cmd);
-			ccb->cmd->result = 0;
+			clear_scsi_result(ccb->cmd);
 			set_host_byte(ccb->cmd, status);
 			ccb->cmd->scsi_done(ccb->cmd);
 			ccb->cmd = NULL;
@@ -613,7 +613,7 @@  stex_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
 	lun = cmd->device->lun;
 	hba = (struct st_hba *) &host->hostdata[0];
 	if (hba->mu_status == MU_STATE_NOCONNECT) {
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_NO_CONNECT);
 		done(cmd);
 		return 0;
@@ -658,7 +658,7 @@  stex_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
 		break;
 	case INQUIRY:
 		if (lun >= host->max_lun) {
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_NO_CONNECT);
 			done(cmd);
 			return 0;
diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index 6a5ca510a3b8..e62b9e434bbe 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -1513,7 +1513,7 @@  static bool storvsc_scsi_cmd_ok(struct scsi_cmnd *scmnd)
 	 * this. So, don't send it.
 	 */
 	case SET_WINDOW:
-		scmnd->result = 0;
+		clear_scsi_result(scmnd);
 		set_host_byte(scmnd, ILLEGAL_REQUEST);
 		allowed = false;
 		break;
diff --git a/drivers/scsi/vmw_pvscsi.c b/drivers/scsi/vmw_pvscsi.c
index b4e123f7527a..7f96730cc123 100644
--- a/drivers/scsi/vmw_pvscsi.c
+++ b/drivers/scsi/vmw_pvscsi.c
@@ -556,7 +556,7 @@  static void pvscsi_complete_request(struct pvscsi_adapter *adapter,
 		return;
 	}
 
-	cmd->result = 0;
+	clear_scsi_result(cmd);
 	if (sdstat != SAM_STAT_GOOD &&
 	    (btstat == BTSTAT_SUCCESS ||
 	     btstat == BTSTAT_LINKED_COMMAND_COMPLETED ||
@@ -570,7 +570,7 @@  static void pvscsi_complete_request(struct pvscsi_adapter *adapter,
 		case BTSTAT_LINKED_COMMAND_COMPLETED:
 		case BTSTAT_LINKED_COMMAND_COMPLETED_WITH_FLAG:
 			/* If everything went fine, let's move on..  */
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_OK);
 			break;
 
@@ -578,13 +578,13 @@  static void pvscsi_complete_request(struct pvscsi_adapter *adapter,
 		case BTSTAT_DATA_UNDERRUN:
 			/* Report residual data in underruns */
 			scsi_set_resid(cmd, scsi_bufflen(cmd) - e->dataLen);
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_ERROR);
 			break;
 
 		case BTSTAT_SELTIMEO:
 			/* Our emulation returns this for non-connected devs */
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_BAD_TARGET);
 			break;
 
@@ -608,22 +608,22 @@  static void pvscsi_complete_request(struct pvscsi_adapter *adapter,
 		case BTSTAT_SENTRST:
 		case BTSTAT_RECVRST:
 		case BTSTAT_BUSRESET:
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_RESET);
 			break;
 
 		case BTSTAT_ABORTQUEUE:
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_ABORT);
 			break;
 
 		case BTSTAT_SCSIPARITY:
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_PARITY);
 			break;
 
 		default:
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_ERROR);
 			scmd_printk(KERN_DEBUG, cmd,
 				    "Unknown completion status: 0x%x\n",
@@ -848,7 +848,7 @@  static int pvscsi_abort(struct scsi_cmnd *cmd)
 	/*
 	 * Successfully aborted the command.
 	 */
-	cmd->result = 0;
+	clear_scsi_result(cmd);
 	set_host_byte(cmd, DID_ABORT);
 	cmd->scsi_done(cmd);
 
@@ -875,7 +875,7 @@  static void pvscsi_reset_all(struct pvscsi_adapter *adapter)
 				    "Forced reset on cmd %p\n", cmd);
 			pvscsi_unmap_buffers(adapter, ctx);
 			pvscsi_release_context(adapter, ctx);
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_RESET);
 			cmd->scsi_done(cmd);
 		}
diff --git a/drivers/scsi/wd33c93.c b/drivers/scsi/wd33c93.c
index 7cb63d6a9e69..2f187fb27261 100644
--- a/drivers/scsi/wd33c93.c
+++ b/drivers/scsi/wd33c93.c
@@ -390,7 +390,7 @@  wd33c93_queuecommand_lck(struct scsi_cmnd *cmd,
  */
 	cmd->host_scribble = NULL;
 	cmd->scsi_done = done;
-	cmd->result = 0;
+	clear_scsi_result(cmd);
 
 /* We use the Scsi_Pointer structure that's included with each command
  * as a scratchpad (as it's intended to be used!). The handy thing about
@@ -862,7 +862,7 @@  wd33c93_intr(struct Scsi_Host *instance)
 			hostdata->selecting = NULL;
 		}
 
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_NO_CONNECT);
 		hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun & 0xff));
 		hostdata->state = S_UNCONNECTED;
@@ -1602,7 +1602,7 @@  wd33c93_host_reset(struct scsi_cmnd * SCpnt)
 	hostdata->outgoing_len = 0;
 
 	reset_wd33c93(instance);
-	SCpnt->result = 0;
+	clear_scsi_result(SCpnt);
 	set_host_byte(SCpnt, DID_RESET);
 	enable_irq(instance->irq);
 	spin_unlock_irq(instance->host_lock);
@@ -1638,7 +1638,7 @@  wd33c93_abort(struct scsi_cmnd * cmd)
 				hostdata->input_Q =
 				    (struct scsi_cmnd *) cmd->host_scribble;
 			cmd->host_scribble = NULL;
-			cmd->result = 0;
+			clear_scsi_result(cmd);
 			set_host_byte(cmd, DID_ABORT);
 			printk
 			    ("scsi%d: Abort - removing command from input_Q. ",
@@ -1713,7 +1713,7 @@  wd33c93_abort(struct scsi_cmnd * cmd)
 		hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun & 0xff));
 		hostdata->connected = NULL;
 		hostdata->state = S_UNCONNECTED;
-		cmd->result = 0;
+		clear_scsi_result(cmd);
 		set_host_byte(cmd, DID_ABORT);
 
 /*      sti();*/
diff --git a/drivers/scsi/wd719x.c b/drivers/scsi/wd719x.c
index 538e1ca14e55..7a05a86b2ed3 100644
--- a/drivers/scsi/wd719x.c
+++ b/drivers/scsi/wd719x.c
@@ -193,7 +193,7 @@  static void wd719x_finish_cmd(struct scsi_cmnd *cmd, int result)
 				 SCSI_SENSE_BUFFERSIZE, DMA_FROM_DEVICE);
 		scsi_dma_unmap(cmd);
 	}
-	cmd->result = 0;
+	clear_scsi_result(cmd);
 	set_host_byte(cmd, result);
 	cmd->scsi_done(cmd);
 }
diff --git a/drivers/scsi/xen-scsifront.c b/drivers/scsi/xen-scsifront.c
index 6f0d46f9dceb..e619470cfe49 100644
--- a/drivers/scsi/xen-scsifront.c
+++ b/drivers/scsi/xen-scsifront.c
@@ -533,7 +533,7 @@  static int scsifront_queuecommand(struct Scsi_Host *shost,
 	unsigned long flags;
 	int err;
 
-	sc->result = 0;
+	clear_scsi_result(sc);
 
 	shadow->sc  = sc;
 	shadow->act = VSCSIIF_ACT_SCSI_CDB;
@@ -551,7 +551,7 @@  static int scsifront_queuecommand(struct Scsi_Host *shost,
 		spin_unlock_irqrestore(shost->host_lock, flags);
 		if (err == -ENOMEM)
 			return SCSI_MLQUEUE_HOST_BUSY;
-		sc->result = 0;
+		clear_scsi_result(sc);
 		set_host_byte(sc, DID_ERROR);
 		sc->scsi_done(sc);
 		return 0;
diff --git a/drivers/staging/rts5208/rtsx.c b/drivers/staging/rts5208/rtsx.c
index 7bb09be01f4c..244a8bac5887 100644
--- a/drivers/staging/rts5208/rtsx.c
+++ b/drivers/staging/rts5208/rtsx.c
@@ -145,7 +145,7 @@  static int queuecommand_lck(struct scsi_cmnd *srb,
 	/* fail the command if we are disconnecting */
 	if (rtsx_chk_stat(chip, RTSX_STAT_DISCONNECT)) {
 		dev_info(&dev->pci->dev, "Fail command during disconnect\n");
-		srb->result = 0;
+		clear_scsi_result(srb);
 		set_host_byte(srb, DID_NO_CONNECT);
 		done(srb);
 		return 0;
diff --git a/drivers/staging/rts5208/rtsx_transport.c b/drivers/staging/rts5208/rtsx_transport.c
index 4838a6e67758..01a1573fd8f8 100644
--- a/drivers/staging/rts5208/rtsx_transport.c
+++ b/drivers/staging/rts5208/rtsx_transport.c
@@ -172,7 +172,7 @@  void rtsx_invoke_transport(struct scsi_cmnd *srb, struct rtsx_chip *chip)
 	 */
 	if (rtsx_chk_stat(chip, RTSX_STAT_ABORT)) {
 		dev_dbg(rtsx_dev(chip), "-- command was aborted\n");
-		srb->result = 0;
+		clear_scsi_result(srb);
 		set_host_byte(srb, DID_ABORT);
 		goto handle_errors;
 	}
@@ -180,7 +180,7 @@  void rtsx_invoke_transport(struct scsi_cmnd *srb, struct rtsx_chip *chip)
 	/* if there is a transport error, reset and don't auto-sense */
 	if (result == TRANSPORT_ERROR) {
 		dev_dbg(rtsx_dev(chip), "-- transport indicates error, resetting\n");
-		srb->result = 0;
+		clear_scsi_result(srb);
 		set_host_byte(srb, DID_ERROR);
 		goto handle_errors;
 	}
diff --git a/drivers/staging/unisys/visorhba/visorhba_main.c b/drivers/staging/unisys/visorhba/visorhba_main.c
index cfbfc9bbc7ef..9c4fec4f6bae 100644
--- a/drivers/staging/unisys/visorhba/visorhba_main.c
+++ b/drivers/staging/unisys/visorhba/visorhba_main.c
@@ -380,7 +380,7 @@  static int visorhba_abort_handler(struct scsi_cmnd *scsicmd)
 		atomic_set(&vdisk->ios_threshold, IOS_ERROR_THRESHOLD);
 	rtn = forward_taskmgmt_command(TASK_MGMT_ABORT_TASK, scsidev);
 	if (rtn == SUCCESS) {
-		scsicmd->result = 0;
+		clear_scsi_result(scsicmd);
 		set_host_byte(scsicmd, DID_ABORT);
 		scsicmd->scsi_done(scsicmd);
 	}
@@ -408,7 +408,7 @@  static int visorhba_device_reset_handler(struct scsi_cmnd *scsicmd)
 		atomic_set(&vdisk->ios_threshold, IOS_ERROR_THRESHOLD);
 	rtn = forward_taskmgmt_command(TASK_MGMT_LUN_RESET, scsidev);
 	if (rtn == SUCCESS) {
-		scsicmd->result = 0;
+		clear_scsi_result(scsicmd);
 		set_host_byte(scsicmd, DID_RESET);
 		scsicmd->scsi_done(scsicmd);
 	}
@@ -438,7 +438,7 @@  static int visorhba_bus_reset_handler(struct scsi_cmnd *scsicmd)
 	}
 	rtn = forward_taskmgmt_command(TASK_MGMT_BUS_RESET, scsidev);
 	if (rtn == SUCCESS) {
-		scsicmd->result = 0;
+		clear_scsi_result(scsicmd);
 		set_host_byte(scsicmd, DID_RESET);
 		scsicmd->scsi_done(scsicmd);
 	}
@@ -755,7 +755,7 @@  static void visorhba_serverdown_complete(struct visorhba_devdata *devdata)
 		switch (pendingdel->cmdtype) {
 		case CMD_SCSI_TYPE:
 			scsicmd = pendingdel->sent;
-			scsicmd->result = 0;
+			clear_scsi_result(scsicmd);
 			set_host_byte(scsicmd, DID_RESET);
 			if (scsicmd->scsi_done)
 				scsicmd->scsi_done(scsicmd);
diff --git a/drivers/usb/image/microtek.c b/drivers/usb/image/microtek.c
index 1c36b23a5628..37b799c1681c 100644
--- a/drivers/usb/image/microtek.c
+++ b/drivers/usb/image/microtek.c
@@ -588,7 +588,7 @@  mts_scsi_queuecommand_lck(struct scsi_cmnd *srb, mts_scsi_cmnd_callback callback
 
 		MTS_DEBUG("this device doesn't exist\n");
 
-		srb->result = 0;
+		clear_scsi_result(srb);
 		set_host_byte(srb, DID_BAD_TARGET);
 
 		if(likely(callback != NULL))
@@ -616,7 +616,7 @@  mts_scsi_queuecommand_lck(struct scsi_cmnd *srb, mts_scsi_cmnd_callback callback
 
 	if(unlikely(res)){
 		MTS_ERROR("error %d submitting URB\n",(int)res);
-		srb->result = 0;
+		clear_scsi_result(srb);
 		set_host_byte(srb, DID_ERROR);
 
 		if(likely(callback != NULL))
diff --git a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c
index ee1b4dabea88..7f18d7847288 100644
--- a/drivers/usb/storage/isd200.c
+++ b/drivers/usb/storage/isd200.c
@@ -644,14 +644,14 @@  static void isd200_invoke_transport( struct us_data *us,
 
 	case USB_STOR_TRANSPORT_ERROR:
 		usb_stor_dbg(us, "-- transport indicates transport error\n");
-		srb->result = 0;
+		clear_scsi_result(srb);
 		set_host_byte(srb, DID_ERROR);
 		/* Need reset here */
 		return;
     
 	default:
 		usb_stor_dbg(us, "-- transport indicates unknown error\n");
-		srb->result = 0;
+		clear_scsi_result(srb);
 		set_host_byte(srb, DID_ERROR);
 		/* Need reset here */
 		return;
@@ -681,7 +681,7 @@  static void isd200_invoke_transport( struct us_data *us,
 			if ((srb->sense_buffer[2] & 0xf) == 0x0)
 				set_status_byte(srb, SAM_STAT_GOOD);
 		} else {
-			srb->result = 0;
+			clear_scsi_result(srb);
 			set_host_byte(srb, DID_ERROR);
 			/* Need reset here */
 		}
@@ -700,7 +700,7 @@  static void isd200_invoke_transport( struct us_data *us,
 	 * following an abort
 	 */
 	Handle_Abort:
-	srb->result = 0;
+	clear_scsi_result(srb);
 	set_host_byte(srb, DID_ABORT);
 
 	/* permit the reset transfer to take place */
@@ -1421,7 +1421,7 @@  static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us,
 	default:
 		usb_stor_dbg(us, "Unsupported SCSI command - 0x%X\n",
 			     srb->cmnd[0]);
-		srb->result = 0;
+		clear_scsi_result(srb);
 		set_host_byte(srb, DID_ERROR);
 		sendToTransport = 0;
 		break;
@@ -1523,7 +1523,7 @@  static void isd200_ata_command(struct scsi_cmnd *srb, struct us_data *us)
 
 	if (us->extra == NULL) {
 		usb_stor_dbg(us, "ERROR Driver not initialized\n");
-		srb->result = 0;
+		clear_scsi_result(srb);
 		set_host_byte(srb, DID_ERROR);
 		return;
 	}
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
index caa1ff055425..76e1ab3d35de 100644
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -371,7 +371,7 @@  static int queuecommand_lck(struct scsi_cmnd *srb,
 	/* fail the command if we are disconnecting */
 	if (test_bit(US_FLIDX_DISCONNECTING, &us->dflags)) {
 		usb_stor_dbg(us, "Fail command during disconnect\n");
-		srb->result = 0;
+		clear_scsi_result(srb);
 		set_host_byte(srb, DID_NO_CONNECT);
 		done(srb);
 		return 0;
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
index e295e9290c04..fefe93108577 100644
--- a/drivers/usb/storage/transport.c
+++ b/drivers/usb/storage/transport.c
@@ -611,7 +611,7 @@  void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
 	 */
 	if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) {
 		usb_stor_dbg(us, "-- command was aborted\n");
-		srb->result = 0;
+		clear_scsi_result(srb);
 		set_host_byte(srb, DID_ABORT);
 		goto Handle_Errors;
 	}
@@ -619,7 +619,7 @@  void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
 	/* if there is a transport error, reset and don't auto-sense */
 	if (result == USB_STOR_TRANSPORT_ERROR) {
 		usb_stor_dbg(us, "-- transport indicates error, resetting\n");
-		srb->result = 0;
+		clear_scsi_result(srb);
 		set_host_byte(srb, DID_ERROR);
 		goto Handle_Errors;
 	}
@@ -724,7 +724,7 @@  void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
 
 		if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) {
 			usb_stor_dbg(us, "-- auto-sense aborted\n");
-			srb->result = 0;
+			clear_scsi_result(srb);
 			set_host_byte(srb, DID_ABORT);
 
 			/* If SANE_SENSE caused this problem, disable it */
@@ -759,7 +759,7 @@  void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
 			 * multi-target device, since failure of an
 			 * auto-sense is perfectly valid
 			 */
-			srb->result = 0;
+			clear_scsi_result(srb);
 			set_host_byte(srb, DID_ERROR);
 			if (!(us->fflags & US_FL_SCM_MULT_TARG))
 				goto Handle_Errors;
@@ -841,7 +841,7 @@  void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
 			 * entering an infinite retry loop.
 			 */
 			else {
-				srb->result = 0;
+				clear_scsi_result(srb);
 				set_host_byte(srb, DID_ERROR);
 				if ((sshdr.response_code & 0x72) == 0x72)
 					srb->sense_buffer[1] = HARDWARE_ERROR;
@@ -875,7 +875,7 @@  void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
 		 */
 		if (test_bit(US_FLIDX_REDO_READ10, &us->dflags)) {
 			clear_bit(US_FLIDX_REDO_READ10, &us->dflags);
-			srb->result = 0;
+			clear_scsi_result(srb);
 			set_host_byte(srb, DID_IMM_RETRY);
 			srb->sense_buffer[0] = 0;
 		}
@@ -885,7 +885,7 @@  void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
 	if ((status_byte(srb->result) == SAM_STAT_GOOD ||
 	     srb->sense_buffer[2] == 0) &&
 	    scsi_bufflen(srb) - scsi_get_resid(srb) < srb->underflow) {
-		srb->result = 0;
+		clear_scsi_result(srb);
 		set_host_byte(srb, DID_ERROR);
 	}
 
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
index 9aa60d935ce5..3c4903b16769 100644
--- a/drivers/usb/storage/uas.c
+++ b/drivers/usb/storage/uas.c
@@ -142,7 +142,7 @@  static void uas_zap_pending(struct uas_dev_info *devinfo, int result)
 		uas_log_cmd_state(cmnd, __func__, 0);
 		/* Sense urbs were killed, clear COMMAND_INFLIGHT manually */
 		cmdinfo->state &= ~COMMAND_INFLIGHT;
-		cmnd->result = 0;
+		clear_scsi_result(cmnd);
 		set_host_byte(cmnd, result);
 		err = uas_try_complete(cmnd, __func__);
 		WARN_ON(err != 0);
@@ -252,20 +252,20 @@  static bool uas_evaluate_response_iu(struct response_iu *riu, struct scsi_cmnd *
 
 	switch (response_code) {
 	case RC_INCORRECT_LUN:
-		cmnd->result = 0;
+		clear_scsi_result(cmnd);
 		set_host_byte(cmnd, DID_BAD_TARGET);
 		break;
 	case RC_TMF_SUCCEEDED:
-		cmnd->result = 0;
+		clear_scsi_result(cmnd);
 		set_host_byte(cmnd, DID_OK);
 		break;
 	case RC_TMF_NOT_SUPPORTED:
-		cmnd->result = 0;
+		clear_scsi_result(cmnd);
 		set_host_byte(cmnd, DID_TARGET_FAILURE);
 		break;
 	default:
 		uas_log_cmd_state(cmnd, "response iu", response_code);
-		cmnd->result = 0;
+		clear_scsi_result(cmnd);
 		set_host_byte(cmnd, DID_ERROR);
 		break;
 	}
@@ -644,7 +644,7 @@  static int uas_queuecommand_lck(struct scsi_cmnd *cmnd,
 	spin_lock_irqsave(&devinfo->lock, flags);
 
 	if (devinfo->resetting) {
-		cmnd->result = 0;
+		clear_scsi_result(cmnd);
 		set_host_byte(cmnd, DID_ERROR);
 		cmnd->scsi_done(cmnd);
 		spin_unlock_irqrestore(&devinfo->lock, flags);
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index a4794feb2aec..09ac2d6cdd01 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -325,7 +325,7 @@  static int usb_stor_control_thread(void * __us)
 
 		/* has the command timed out *already* ? */
 		if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) {
-			srb->result = 0;
+			clear_scsi_result(srb);
 			set_host_byte(srb, DID_ABORT);
 			goto SkipForAbort;
 		}
@@ -338,7 +338,7 @@  static int usb_stor_control_thread(void * __us)
 		 */
 		if (srb->sc_data_direction == DMA_BIDIRECTIONAL) {
 			usb_stor_dbg(us, "UNKNOWN data direction\n");
-			srb->result = 0;
+			clear_scsi_result(srb);
 			set_host_byte(srb, DID_ERROR);
 		}
 
@@ -351,7 +351,7 @@  static int usb_stor_control_thread(void * __us)
 			usb_stor_dbg(us, "Bad target number (%d:%llu)\n",
 				     srb->device->id,
 				     srb->device->lun);
-			srb->result = 0;
+			clear_scsi_result(srb);
 			set_host_byte(srb, DID_BAD_TARGET);
 		}
 
@@ -359,7 +359,7 @@  static int usb_stor_control_thread(void * __us)
 			usb_stor_dbg(us, "Bad LUN (%d:%llu)\n",
 				     srb->device->id,
 				     srb->device->lun);
-			srb->result = 0;
+			clear_scsi_result(srb);
 			set_host_byte(srb, DID_BAD_TARGET);
 		}
 
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 32bc3e5fad53..f1baac59dc16 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -369,6 +369,11 @@  static inline void set_scsi_result(struct scsi_cmnd *cmd,
 	cmd->result = db << 24 | hb << 16 | mb << 8 | status;
 }
 
+static inline void clear_scsi_result(struct scsi_cmnd *cmd)
+{
+	cmd->result = 0;
+}
+
 static inline unsigned scsi_transfer_length(struct scsi_cmnd *scmd)
 {
 	unsigned int xfer_len = scsi_out(scmd)->length;