[patch] PM / devfreq: exynos-ppmu: fix load_count calculation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"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@xxxxxxxxxx>

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;
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux