From: Hauke Mehrtens Date: Wed, 5 Dec 2012 17:46:06 +0000 (+0100) Subject: ssb: extif: add check for max value before setting watchdog register X-Git-Tag: MMI-PSA29.97-13-9~15401^2~17^2~65 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7280b51a29f8e6cc7d449d565182d1e1b6183907;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git ssb: extif: add check for max value before setting watchdog register Prevent the watchdog register on the extif core to be set to a too high value. Signed-off-by: Hauke Mehrtens Signed-off-by: John W. Linville --- diff --git a/drivers/ssb/driver_extif.c b/drivers/ssb/driver_extif.c index dc47f30e9cf7..0aa4c2a85774 100644 --- a/drivers/ssb/driver_extif.c +++ b/drivers/ssb/driver_extif.c @@ -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); } diff --git a/include/linux/ssb/ssb_driver_extif.h b/include/linux/ssb/ssb_driver_extif.h index 2604efa7dc4d..b618188939d2 100644 --- a/include/linux/ssb/ssb_driver_extif.h +++ b/include/linux/ssb/ssb_driver_extif.h @@ -152,6 +152,7 @@ /* watchdog */ #define SSB_EXTIF_WATCHDOG_CLK 48000000 /* Hz */ +#define SSB_EXTIF_WATCHDOG_MAX_TIMER ((1 << 28) - 1) #ifdef CONFIG_SSB_DRIVER_EXTIF