aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorAtsushi Nemoto <anemo@mba.ocn.ne.jp>2009-04-02 12:01:21 -0400
committerRalf Baechle <ralf@linux-mips.org>2009-05-14 08:50:27 -0400
commit740ebe4a54fae1705705ec87ce511b16ffb50659 (patch)
treef560d2d8d01c6c85108ad01ae244d5e9a4dcee25 /arch/mips
parent4f29c057aa81c5440f06b716f768ba9f8a041fe9 (diff)
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: Atsushi Nemoto <anemo@mba.ocn.ne.jp> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/txx9/generic/setup_tx4927.c2
-rw-r--r--arch/mips/txx9/generic/setup_tx4938.c2
-rw-r--r--arch/mips/txx9/generic/setup_tx4939.c2
3 files changed, 3 insertions, 3 deletions
diff --git a/arch/mips/txx9/generic/setup_tx4927.c b/arch/mips/txx9/generic/setup_tx4927.c
index 914e93c62639..1093549df1a8 100644
--- a/arch/mips/txx9/generic/setup_tx4927.c
+++ b/arch/mips/txx9/generic/setup_tx4927.c
@@ -88,7 +88,7 @@ void __init tx4927_setup(void)
88{ 88{
89 int i; 89 int i;
90 __u32 divmode; 90 __u32 divmode;
91 int cpuclk = 0; 91 unsigned int cpuclk = 0;
92 u64 ccfg; 92 u64 ccfg;
93 93
94 txx9_reg_res_init(TX4927_REV_PCODE(), TX4927_REG_BASE, 94 txx9_reg_res_init(TX4927_REV_PCODE(), TX4927_REG_BASE,
diff --git a/arch/mips/txx9/generic/setup_tx4938.c b/arch/mips/txx9/generic/setup_tx4938.c
index f0844f891f0b..3925219b8973 100644
--- a/arch/mips/txx9/generic/setup_tx4938.c
+++ b/arch/mips/txx9/generic/setup_tx4938.c
@@ -93,7 +93,7 @@ void __init tx4938_setup(void)
93{ 93{
94 int i; 94 int i;
95 __u32 divmode; 95 __u32 divmode;
96 int cpuclk = 0; 96 unsigned int cpuclk = 0;
97 u64 ccfg; 97 u64 ccfg;
98 98
99 txx9_reg_res_init(TX4938_REV_PCODE(), TX4938_REG_BASE, 99 txx9_reg_res_init(TX4938_REV_PCODE(), TX4938_REG_BASE,
diff --git a/arch/mips/txx9/generic/setup_tx4939.c b/arch/mips/txx9/generic/setup_tx4939.c
index 7a25b573e9b0..c2bf150c8838 100644
--- a/arch/mips/txx9/generic/setup_tx4939.c
+++ b/arch/mips/txx9/generic/setup_tx4939.c
@@ -114,7 +114,7 @@ void __init tx4939_setup(void)
114 int i; 114 int i;
115 __u32 divmode; 115 __u32 divmode;
116 __u64 pcfg; 116 __u64 pcfg;
117 int cpuclk = 0; 117 unsigned int cpuclk = 0;
118 118
119 txx9_reg_res_init(TX4939_REV_PCODE(), TX4939_REG_BASE, 119 txx9_reg_res_init(TX4939_REV_PCODE(), TX4939_REG_BASE,
120 TX4939_REG_SIZE); 120 TX4939_REG_SIZE);