Skip to content

Commit

Permalink
cpufreq: ppc: Fix integer overflow in expression
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Geert Uytterhoeven authored and Rafael J. Wysocki committed Apr 21, 2014
1 parent f3cae35 commit 1612343
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/cpufreq/ppc-corenet-cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,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();
of_node_put(np);

return 0;
Expand Down

0 comments on commit 1612343

Please sign in to comment.