08972afee04334468352c0f8e9c859912af90d01
[openwrt/svn-archive/archive.git] / target / linux / ar71xx / patches-3.10 / 611-MIPS-ath79-wdt-timeout.patch
1 MIPS: ath79: fix maximum timeout
2
3 If the userland tries to set a timeout higher than the max_timeout, then we should fallback to max_timeout.
4
5 Signed-off-by: John Crispin <blogic@openwrt.org>
6
7 --- a/drivers/watchdog/ath79_wdt.c
8 +++ b/drivers/watchdog/ath79_wdt.c
9 @@ -105,10 +105,14 @@ static inline void ath79_wdt_disable(voi
10
11 static int ath79_wdt_set_timeout(int val)
12 {
13 - if (val < 1 || val > max_timeout)
14 + if (val < 1)
15 return -EINVAL;
16
17 - timeout = val;
18 + if (val > max_timeout)
19 + timeout = max_timeout;
20 + else
21 + timeout = val;
22 +
23 ath79_wdt_keepalive();
24
25 return 0;