diff options
author | Zhang Zhuoyu <Zhuoyu.Zhang@freescale.com> | 2014-05-26 02:31:07 (GMT) |
---|---|---|
committer | Jose Rivera <German.Rivera@freescale.com> | 2014-05-27 14:01:29 (GMT) |
commit | 85bf3f3ec70b48f39c8b57876d0bc91bc04ba142 (patch) | |
tree | 6440ab527cf28a7bc83b7ee75b80baac4445c5f0 /drivers/cpufreq | |
parent | 538ad2a3f8d0c3536ad4e84f5ffe4c3185347584 (diff) | |
download | linux-fsl-qoriq-85bf3f3ec70b48f39c8b57876d0bc91bc04ba142.tar.xz |
cpufreq: ppc: Fix integer overflow in expression
On 32-bit, "12 * NSEC_PER_SEC" doesn't fit in "unsigned long"
(NSEC_PER_SEC is a "long" constant), causing an integer overflow:
drivers/cpufreq/ppc-corenet-cpufreq.c: In function 'corenet_cpufreq_cpu_init':
drivers/cpufreq/ppc-corenet-cpufreq.c:211:9: warning: integer overflow in expression [-Woverflow]
Force the intermediate to be 64-bit by adding an "ULL" suffix to the
constant multiplier to fix this.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Zhang Zhuoyu <Zhuoyu.Zhang@freescale.com>
Change-Id: I488325db883101c51df1df8a8ffbaf955683432f
Reviewed-on: http://git.am.freescale.net:8181/12858
Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com>
Reviewed-by: Yuantian Tang <yuantian.tang@freescale.com>
Reviewed-by: Jose Rivera <German.Rivera@freescale.com>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r-- | drivers/cpufreq/ppc-corenet-cpufreq.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/cpufreq/ppc-corenet-cpufreq.c b/drivers/cpufreq/ppc-corenet-cpufreq.c index 79173af..f759ab7 100644 --- a/drivers/cpufreq/ppc-corenet-cpufreq.c +++ b/drivers/cpufreq/ppc-corenet-cpufreq.c @@ -217,7 +217,7 @@ static int corenet_cpufreq_cpu_init(struct cpufreq_policy *policy) per_cpu(cpu_data, i) = data; policy->cpuinfo.transition_latency = - (12 * NSEC_PER_SEC) / fsl_get_sys_freq(); + (12ULL * NSEC_PER_SEC) / fsl_get_sys_freq(); policy->cur = corenet_cpufreq_get_speed(policy->cpu); cpufreq_frequency_table_get_attr(table, cpu); |