ignatenkobrain / rpms / kernel

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