ssb: extif: add check for max value before setting watchdog register
authorHauke Mehrtens <hauke@hauke-m.de>
Wed, 5 Dec 2012 17:46:06 +0000 (18:46 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 6 Dec 2012 19:58:57 +0000 (14:58 -0500)
Prevent the watchdog register on the extif core to be set to a too
high value.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/ssb/driver_extif.c
include/linux/ssb/ssb_driver_extif.h

index dc47f30e9cf7c1be458291ba0d9691bc7768e569..0aa4c2a857746f4f699dbfa1eb80c1c676716b9c 100644 (file)
@@ -112,9 +112,10 @@ void ssb_extif_get_clockcontrol(struct ssb_extif *extif,
        *m = extif_read32(extif, SSB_EXTIF_CLOCK_SB);
 }
 
-void ssb_extif_watchdog_timer_set(struct ssb_extif *extif,
-                                 u32 ticks)
+void ssb_extif_watchdog_timer_set(struct ssb_extif *extif, u32 ticks)
 {
+       if (ticks > SSB_EXTIF_WATCHDOG_MAX_TIMER)
+               ticks = SSB_EXTIF_WATCHDOG_MAX_TIMER;
        extif_write32(extif, SSB_EXTIF_WATCHDOG, ticks);
 }
 
index 2604efa7dc4dd31e730fe86ba54d0791a64d10b7..b618188939d278ecd2669ba0a2d6d8283cbcede1 100644 (file)
 /* watchdog */
 #define SSB_EXTIF_WATCHDOG_CLK         48000000        /* Hz */
 
+#define SSB_EXTIF_WATCHDOG_MAX_TIMER   ((1 << 28) - 1)
 
 
 #ifdef CONFIG_SSB_DRIVER_EXTIF