From patchwork Thu Jan 5 08:45:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Winkler, Tomas" X-Patchwork-Id: 9498559 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CD2E160235 for ; Thu, 5 Jan 2017 07:51:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BCB722815E for ; Thu, 5 Jan 2017 07:51:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AFA2628173; Thu, 5 Jan 2017 07:51:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3CA8627F99 for ; Thu, 5 Jan 2017 07:51:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031006AbdAEHuB (ORCPT ); Thu, 5 Jan 2017 02:50:01 -0500 Received: from mga05.intel.com ([192.55.52.43]:60831 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031149AbdAEHt6 (ORCPT ); Thu, 5 Jan 2017 02:49:58 -0500 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP; 04 Jan 2017 23:49:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,320,1477983600"; d="scan'208";a="1090158520" Received: from twinkler-lnx.jer.intel.com ([10.12.87.167]) by fmsmga001.fm.intel.com with ESMTP; 04 Jan 2017 23:49:55 -0800 From: Tomas Winkler To: James Bottomley , "Martin K . Petersen" , Vinayak Holikatti Cc: Christoph Hellwig , Yaniv Gardi , Subhash Jadavani , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Tomas Winkler Subject: [scsi 3/4] scsi: ufs: ufshcd_get_max_icc_level fix endianity handling Date: Thu, 5 Jan 2017 10:45:11 +0200 Message-Id: <1483605912-15041-3-git-send-email-tomas.winkler@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1483605912-15041-1-git-send-email-tomas.winkler@intel.com> References: <1483605912-15041-1-git-send-email-tomas.winkler@intel.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Subhash Jadavani --- drivers/scsi/ufs/ufshcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 63d7ae2c3be9..fdea08f79b7d 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -4822,7 +4822,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;