From patchwork Mon Aug 17 14:48:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 7025371 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1494DC05AC for ; Mon, 17 Aug 2015 14:49:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4555320644 for ; Mon, 17 Aug 2015 14:49:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5EB47205F5 for ; Mon, 17 Aug 2015 14:49:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753919AbbHQOtQ (ORCPT ); Mon, 17 Aug 2015 10:49:16 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:37585 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751427AbbHQOtP (ORCPT ); Mon, 17 Aug 2015 10:49:15 -0400 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t7HEnAcC020165 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 17 Aug 2015 14:49:11 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.13.8/8.13.8) with ESMTP id t7HEnA1p002111 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Mon, 17 Aug 2015 14:49:10 GMT Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by userv0121.oracle.com (8.13.8/8.13.8) with ESMTP id t7HEn9MF032489; Mon, 17 Aug 2015 14:49:09 GMT Received: from mwanda (/154.0.139.178) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 17 Aug 2015 07:49:05 -0700 Date: Mon, 17 Aug 2015 17:48:56 +0300 From: Dan Carpenter To: MyungJoo Ham , Chanwoo Choi Cc: Kyungmin Park , Krzysztof Kozlowski , linux-samsung-soc@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] PM / devfreq: exynos-ppmu: fix load_count calculation Message-ID: <20150817144856.GD23820@mwanda> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP "pmcnt_high & 0xff" is a u32 so we shifting it 32 spaces is zero. GCC catches this bug: drivers/devfreq/event/exynos-ppmu.c: In function ‘exynos_ppmu_v2_get_event’: drivers/devfreq/event/exynos-ppmu.c:322:3: warning: left shift count >= width of type load_count = (u64)((pmcnt_high & 0xff) << 32) + (u64)pmcnt_low; Fixes: 3d87b02281a2 ('PM / devfreq: exynos-ppmu: Add the support of PPMUv2 for Exynos5433') Signed-off-by: Dan Carpenter --- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/devfreq/event/exynos-ppmu.c b/drivers/devfreq/event/exynos-ppmu.c index f9901f5..daf2cdb 100644 --- a/drivers/devfreq/event/exynos-ppmu.c +++ b/drivers/devfreq/event/exynos-ppmu.c @@ -319,7 +319,7 @@ static int exynos_ppmu_v2_get_event(struct devfreq_event_dev *edev, case PPMU_PMNCNT3: pmcnt_high = __raw_readl(info->ppmu.base + PPMU_V2_PMCNT3_HIGH); pmcnt_low = __raw_readl(info->ppmu.base + PPMU_V2_PMCNT3_LOW); - load_count = (u64)((pmcnt_high & 0xff) << 32) + (u64)pmcnt_low; + load_count = (((u64)pmcnt_high & 0xff) << 32) + pmcnt_low; break; } edata->load_count = load_count;