mfd: pm8xxx-pwm: fix an overflow bug

The overflow could be the multiplication (period_us * NSEC_PER_USEC)
in next line, rather than at the 6-bit max period value. So we should
use the max unsigned int value as boundary.

Change-Id: Ida753d752a8ca144b4c158e1a6ed505077de98ea
Signed-off-by: Willie Ruan <wruan@codeaurora.org>
diff --git a/drivers/mfd/pm8xxx-pwm.c b/drivers/mfd/pm8xxx-pwm.c
index f65a183..6ffc7cc 100644
--- a/drivers/mfd/pm8xxx-pwm.c
+++ b/drivers/mfd/pm8xxx-pwm.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -342,7 +342,7 @@
 	unsigned int	tmp_p, last_p, min_err, period_n;
 
 	/* PWM Period / N */
-	if (period_us < (40 * USEC_PER_SEC)) {  /* ~6-bit max */
+	if (period_us < ((unsigned)(-1) / NSEC_PER_USEC)) {
 		period_n = (period_us * NSEC_PER_USEC) >> 6;
 		n = 6;
 	} else if (period_us < (274 * USEC_PER_SEC)) { /* overflow threshold */