potatogim / rpms / kernel

Forked from rpms/kernel 3 years ago
Clone
a8a466
From c73c42f25ffbb9a519ea942a9a943069abf6d6be Mon Sep 17 00:00:00 2001
a8a466
From: Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>
a8a466
Date: Wed, 26 Oct 2016 13:34:41 +0530
a8a466
Subject: [PATCH 10/11] scsi: mpt3sas: Fix for Endianness issue.
a8a466
a8a466
Use le16_to_cpu only for accessing two byte data provided by controller.
a8a466
a8a466
Signed-off-by: Chaitra P B <chaitra.basappa@broadcom.com>
a8a466
Signed-off-by: Sathya Prakash <sathya.prakash@broadcom.com>
a8a466
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
a8a466
Reviewed-by: Hannes Reinecke <hare@suse.com>
a8a466
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
a8a466
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
a8a466
---
a8a466
 drivers/scsi/mpt3sas/mpt3sas_scsih.c | 12 +++++++-----
a8a466
 1 file changed, 7 insertions(+), 5 deletions(-)
a8a466
a8a466
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
a8a466
index 0dcf826..55b4472 100644
a8a466
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
a8a466
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
a8a466
@@ -5442,10 +5442,10 @@ _scsih_check_device(struct MPT3SAS_ADAPTER *ioc,
a8a466
 			sas_device->handle, handle);
a8a466
 		sas_target_priv_data->handle = handle;
a8a466
 		sas_device->handle = handle;
a8a466
-		if (sas_device_pg0.Flags &
a8a466
+		if (le16_to_cpu(sas_device_pg0.Flags) &
a8a466
 		     MPI2_SAS_DEVICE0_FLAGS_ENCL_LEVEL_VALID) {
a8a466
 			sas_device->enclosure_level =
a8a466
-				le16_to_cpu(sas_device_pg0.EnclosureLevel);
a8a466
+				sas_device_pg0.EnclosureLevel;
a8a466
 			memcpy(&sas_device->connector_name[0],
a8a466
 				&sas_device_pg0.ConnectorName[0], 4);
a8a466
 		} else {
a8a466
@@ -5573,9 +5573,10 @@ _scsih_add_device(struct MPT3SAS_ADAPTER *ioc, u16 handle, u8 phy_num,
a8a466
 	sas_device->fast_path = (le16_to_cpu(sas_device_pg0.Flags) &
a8a466
 	    MPI25_SAS_DEVICE0_FLAGS_FAST_PATH_CAPABLE) ? 1 : 0;
a8a466
 
a8a466
-	if (sas_device_pg0.Flags & MPI2_SAS_DEVICE0_FLAGS_ENCL_LEVEL_VALID) {
a8a466
+	if (le16_to_cpu(sas_device_pg0.Flags)
a8a466
+		& MPI2_SAS_DEVICE0_FLAGS_ENCL_LEVEL_VALID) {
a8a466
 		sas_device->enclosure_level =
a8a466
-			le16_to_cpu(sas_device_pg0.EnclosureLevel);
a8a466
+			sas_device_pg0.EnclosureLevel;
a8a466
 		memcpy(&sas_device->connector_name[0],
a8a466
 			&sas_device_pg0.ConnectorName[0], 4);
a8a466
 	} else {
a8a466
@@ -7115,7 +7116,7 @@ Mpi2SasDevicePage0_t *sas_device_pg0)
a8a466
 			if (sas_device_pg0->Flags &
a8a466
 			      MPI2_SAS_DEVICE0_FLAGS_ENCL_LEVEL_VALID) {
a8a466
 				sas_device->enclosure_level =
a8a466
-				   le16_to_cpu(sas_device_pg0->EnclosureLevel);
a8a466
+				   sas_device_pg0->EnclosureLevel;
a8a466
 				memcpy(&sas_device->connector_name[0],
a8a466
 					&sas_device_pg0->ConnectorName[0], 4);
a8a466
 			} else {
a8a466
@@ -7177,6 +7178,7 @@ _scsih_search_responding_sas_devices(struct MPT3SAS_ADAPTER *ioc)
a8a466
 		sas_device_pg0.SASAddress =
a8a466
 				le64_to_cpu(sas_device_pg0.SASAddress);
a8a466
 		sas_device_pg0.Slot = le16_to_cpu(sas_device_pg0.Slot);
a8a466
+		sas_device_pg0.Flags = le16_to_cpu(sas_device_pg0.Flags);
a8a466
 		_scsih_mark_responding_sas_device(ioc, &sas_device_pg0);
a8a466
 	}
a8a466
 
a8a466
-- 
a8a466
1.8.3.1
a8a466