lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1329230947-27675-1-git-send-email-danny.kukawka@bisect.de>
Date:	Tue, 14 Feb 2012 15:49:07 +0100
From:	Danny Kukawka <danny.kukawka@...ect.de>
To:	"James E.J. Bottomley" <JBottomley@...allels.com>
Cc:	Danny Kukawka <dkukawka@...e.de>, Jeff Garzik <jgarzik@...hat.com>,
	Sergei Shtylyov <sshtylyov@...mvista.com>,
	Dan Williams <dan.j.williams@...el.com>,
	Christoph Hellwig <hch@....de>,
	Paul Gortmaker <paul.gortmaker@...driver.com>,
	linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] libsas: move SAM_STAT_CHECK_CONDITION out of switch

Move SAM_STAT_CHECK_CONDITION out of switch to fix:

warning: case value ‘2’ not in enumerated type ‘enum exec_status’
  [-Wswitch]

Signed-off-by: Danny Kukawka <danny.kukawka@...ect.de>
---
 drivers/scsi/libsas/sas_ata.c       |    3 +-
 drivers/scsi/libsas/sas_scsi_host.c |   91 ++++++++++++++++++-----------------
 2 files changed, 48 insertions(+), 46 deletions(-)

diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
index db9238f..4cbdb6e 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -43,6 +43,8 @@ static enum ata_completion_errors sas_to_ata_err(struct task_status_struct *ts)
 	/* transport error */
 	if (ts->resp == SAS_TASK_UNDELIVERED)
 		return AC_ERR_ATA_BUS;
+	if (ts->stat == SAM_STAT_CHECK_CONDITION)
+		return AC_ERR_DEV;
 
 	/* ts->resp == SAS_TASK_COMPLETE */
 	/* task delivered, what happened afterwards? */
@@ -77,7 +79,6 @@ static enum ata_completion_errors sas_to_ata_err(struct task_status_struct *ts)
 				    __func__, ts->stat);
 			return AC_ERR_OTHER;
 
-		case SAM_STAT_CHECK_CONDITION:
 		case SAS_ABORTED_TASK:
 			return AC_ERR_DEV;
 
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index b6e233d..559b37c 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -75,53 +75,54 @@ static void sas_scsi_task_done(struct sas_task *task)
 		hs = DID_NO_CONNECT;
 	} else { /* ts->resp == SAS_TASK_COMPLETE */
 		/* task delivered, what happened afterwards? */
-		switch (ts->stat) {
-		case SAS_DEV_NO_RESPONSE:
-		case SAS_INTERRUPTED:
-		case SAS_PHY_DOWN:
-		case SAS_NAK_R_ERR:
-		case SAS_OPEN_TO:
-			hs = DID_NO_CONNECT;
-			break;
-		case SAS_DATA_UNDERRUN:
-			scsi_set_resid(sc, ts->residual);
-			if (scsi_bufflen(sc) - scsi_get_resid(sc) < sc->underflow)
-				hs = DID_ERROR;
-			break;
-		case SAS_DATA_OVERRUN:
-			hs = DID_ERROR;
-			break;
-		case SAS_QUEUE_FULL:
-			hs = DID_SOFT_ERROR; /* retry */
-			break;
-		case SAS_DEVICE_UNKNOWN:
-			hs = DID_BAD_TARGET;
-			break;
-		case SAS_SG_ERR:
-			hs = DID_PARITY;
-			break;
-		case SAS_OPEN_REJECT:
-			if (ts->open_rej_reason == SAS_OREJ_RSVD_RETRY)
-				hs = DID_SOFT_ERROR; /* retry */
-			else
-				hs = DID_ERROR;
-			break;
-		case SAS_PROTO_RESPONSE:
-			SAS_DPRINTK("LLDD:%s sent SAS_PROTO_RESP for an SSP "
-				    "task; please report this\n",
-				    task->dev->port->ha->sas_ha_name);
-			break;
-		case SAS_ABORTED_TASK:
-			hs = DID_ABORT;
-			break;
-		case SAM_STAT_CHECK_CONDITION:
+		if (ts->stat == SAM_STAT_CHECK_CONDITION) {
 			memcpy(sc->sense_buffer, ts->buf,
-			       min(SCSI_SENSE_BUFFERSIZE, ts->buf_valid_size));
+				min(SCSI_SENSE_BUFFERSIZE, ts->buf_valid_size));
 			stat = SAM_STAT_CHECK_CONDITION;
-			break;
-		default:
-			stat = ts->stat;
-			break;
+		} else {
+			switch (ts->stat) {
+			case SAS_DEV_NO_RESPONSE:
+			case SAS_INTERRUPTED:
+			case SAS_PHY_DOWN:
+			case SAS_NAK_R_ERR:
+			case SAS_OPEN_TO:
+				hs = DID_NO_CONNECT;
+				break;
+			case SAS_DATA_UNDERRUN:
+				scsi_set_resid(sc, ts->residual);
+				if (scsi_bufflen(sc) - scsi_get_resid(sc) < sc->underflow)
+					hs = DID_ERROR;
+				break;
+			case SAS_DATA_OVERRUN:
+				hs = DID_ERROR;
+				break;
+			case SAS_QUEUE_FULL:
+				hs = DID_SOFT_ERROR; /* retry */
+				break;
+			case SAS_DEVICE_UNKNOWN:
+				hs = DID_BAD_TARGET;
+				break;
+			case SAS_SG_ERR:
+				hs = DID_PARITY;
+				break;
+			case SAS_OPEN_REJECT:
+				if (ts->open_rej_reason == SAS_OREJ_RSVD_RETRY)
+					hs = DID_SOFT_ERROR; /* retry */
+				else
+					hs = DID_ERROR;
+				break;
+			case SAS_PROTO_RESPONSE:
+				SAS_DPRINTK("LLDD:%s sent SAS_PROTO_RESP for "
+					    "an SSP task; please report this\n",
+					    task->dev->port->ha->sas_ha_name);
+				break;
+			case SAS_ABORTED_TASK:
+				hs = DID_ABORT;
+				break;
+			default:
+				stat = ts->stat;
+				break;
+			}
 		}
 	}
 	ASSIGN_SAS_TASK(sc, NULL);
-- 
1.7.7.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ