ignatenkobrain / rpms / kernel

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