Skip to contentSkip to conversation

x86: hpet: clean up warning (hpet_freq)

PATCH New Christoph Fritz 1 participant 1 message Aug 11, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: hpet: clean up warning (hpet_freq)

hpet_freq is (FSEC_PER_NSEC * NSEC_PER_SEC). This patch also fixes the below compile warning due to recently added preprocessor calculation for hpet_freq.

arch/x86/kernel/hpet.c: In function ¡hpet_clocksource_register¢:
arch/x86/kernel/hpet.c:840: warning: integer overflow in expression

---
 arch/x86/kernel/hpet.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/hpet.c +2 -2
index 33dbcc4..86643ce 100644
@@ -582,7 +582,7 @@ static void init_one_hpet_msi_clockevent(struct hpet_dev *hdev, int cpu)
 	 * scaled math multiplication factor for nanosecond to hpet tick
 	 * conversion.
 	 */
-	hpet_freq = 1000000000000000ULL;
+	hpet_freq = (uint64_t)FSEC_PER_NSEC * (uint64_t)NSEC_PER_SEC;
 	do_div(hpet_freq, hpet_period);
 	evt->mult = div_sc((unsigned long) hpet_freq,
 				      NSEC_PER_SEC, evt->shift);
@@ -837,7 +837,7 @@ static int hpet_clocksource_register(void)
 	 * cyc/sec = FSEC_PER_SEC/hpet_period(fsec/cyc)
 	 * cyc/sec = (FSEC_PER_NSEC * NSEC_PER_SEC)/hpet_period
 	 */
-	hpet_freq = FSEC_PER_NSEC * NSEC_PER_SEC;
+	hpet_freq = (u64)FSEC_PER_NSEC * (u64)NSEC_PER_SEC;
 	do_div(hpet_freq, hpet_period);
 	clocksource_register_hz(&clocksource_hpet, (u32)hpet_freq);
 
Signature · 8 lines
1.7.1



--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html