Commit 740ebe4a authored by Atsushi Nemoto's avatar Atsushi Nemoto Committed by Ralf Baechle

MIPS: TXx9: Fix possible overflow in clock calculations

Addition of -fwrapv option in 2.6.29 discloses possible overflow with
signed arithmetics.  For example, result of "a * 6 / 12" (int a =
400000000) is 200000000 without -fwrapv but -157913941 with -fwrapv.

Change some variable to unsigned to avoid such overflows.
Signed-off-by: default avatarAtsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 4f29c057
...@@ -88,7 +88,7 @@ void __init tx4927_setup(void) ...@@ -88,7 +88,7 @@ void __init tx4927_setup(void)
{ {
int i; int i;
__u32 divmode; __u32 divmode;
int cpuclk = 0; unsigned int cpuclk = 0;
u64 ccfg; u64 ccfg;
txx9_reg_res_init(TX4927_REV_PCODE(), TX4927_REG_BASE, txx9_reg_res_init(TX4927_REV_PCODE(), TX4927_REG_BASE,
......
...@@ -93,7 +93,7 @@ void __init tx4938_setup(void) ...@@ -93,7 +93,7 @@ void __init tx4938_setup(void)
{ {
int i; int i;
__u32 divmode; __u32 divmode;
int cpuclk = 0; unsigned int cpuclk = 0;
u64 ccfg; u64 ccfg;
txx9_reg_res_init(TX4938_REV_PCODE(), TX4938_REG_BASE, txx9_reg_res_init(TX4938_REV_PCODE(), TX4938_REG_BASE,
......
...@@ -114,7 +114,7 @@ void __init tx4939_setup(void) ...@@ -114,7 +114,7 @@ void __init tx4939_setup(void)
int i; int i;
__u32 divmode; __u32 divmode;
__u64 pcfg; __u64 pcfg;
int cpuclk = 0; unsigned int cpuclk = 0;
txx9_reg_res_init(TX4939_REV_PCODE(), TX4939_REG_BASE, txx9_reg_res_init(TX4939_REV_PCODE(), TX4939_REG_BASE,
TX4939_REG_SIZE); TX4939_REG_SIZE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment