diff options
author | Geert Uytterhoeven <geert+renesas@glider.be> | 2014-04-17 05:53:26 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-04-21 17:47:06 -0400 |
commit | 1612343a264b2791f4602f4b47dac853e0892ec0 (patch) | |
tree | c50fbfee371c65b2cab01a7c6c01309e251eef88 | |
parent | f3cae355a962784101478504ef7f6a389ad62979 (diff) |
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>
-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 b7e677be1df0..a1ca3dd04a8e 100644 --- a/drivers/cpufreq/ppc-corenet-cpufreq.c +++ b/drivers/cpufreq/ppc-corenet-cpufreq.c | |||
@@ -206,7 +206,7 @@ static int corenet_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
206 | per_cpu(cpu_data, i) = data; | 206 | per_cpu(cpu_data, i) = data; |
207 | 207 | ||
208 | policy->cpuinfo.transition_latency = | 208 | policy->cpuinfo.transition_latency = |
209 | (12 * NSEC_PER_SEC) / fsl_get_sys_freq(); | 209 | (12ULL * NSEC_PER_SEC) / fsl_get_sys_freq(); |
210 | of_node_put(np); | 210 | of_node_put(np); |
211 | 211 | ||
212 | return 0; | 212 | return 0; |