scsi: ufs: ufshcd_get_max_icc_level fix endianity handling
authorTomas Winkler <tomas.winkler@intel.com>
Thu, 5 Jan 2017 08:45:11 +0000 (10:45 +0200)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 11 Jan 2017 03:59:58 +0000 (22:59 -0500)
Reading big endian value from a buffer requires explicit cast.
Fix sparse warning:
drivers/scsi/ufs/ufshcd.c:4825:24: warning: cast to restricted __be16

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/ufs/ufshcd.c

index b9b653d332e08662ced5252664465b0c5cb8494d..99731a062f80e033bef2b320eebcbeec1640251c 100644 (file)
@@ -5266,7 +5266,7 @@ static u32 ufshcd_get_max_icc_level(int sup_curr_uA, u32 start_scan, char *buff)
        u16 unit;
 
        for (i = start_scan; i >= 0; i--) {
-               data = be16_to_cpu(*((u16 *)(buff + 2*i)));
+               data = be16_to_cpup((__be16 *)&buff[2 * i]);
                unit = (data & ATTR_ICC_LVL_UNIT_MASK) >>
                                                ATTR_ICC_LVL_UNIT_OFFSET;
                curr_uA = data & ATTR_ICC_LVL_VALUE_MASK;