public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] PM / devfreq: exynos-ppmu: fix load_count calculation
@ 2015-08-17 14:48 Dan Carpenter
  2015-08-18  0:52 ` MyungJoo Ham
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-08-17 14:48 UTC (permalink / raw)
  To: MyungJoo Ham, Chanwoo Choi
  Cc: Kyungmin Park, Krzysztof Kozlowski, linux-samsung-soc,
	kernel-janitors

"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 <dan.carpenter@oracle.com>

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;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-08-18  0:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-17 14:48 [patch] PM / devfreq: exynos-ppmu: fix load_count calculation Dan Carpenter
2015-08-18  0:52 ` MyungJoo Ham

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox