Re: [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>

This patch has been waiting in devfreq tree for some days.
It will be sent with the next pull request.

https://git.kernel.org/cgit/linux/kernel/git/mzx/devfreq.git/commit/?h=for-rafael&id=8e29abebbdb32a30d87a58201ac9b77f8a87fd84

> 
> 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;
> 
��.n��������+%������w��{.n����z�ޗ�����n�r������&��z�ޗ�zf���h���~����������_��+v���)ߣ�

[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