ar71xx: fix maximum watchdog timeout
[openwrt/svn-archive/archive.git] / target / linux / ar71xx / patches-3.8 / 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 Index: linux-3.8.13/drivers/watchdog/ath79_wdt.c
8 ===================================================================
9 --- linux-3.8.13.orig/drivers/watchdog/ath79_wdt.c 2013-07-14 14:10:19.198826462 +0200
10 +++ linux-3.8.13/drivers/watchdog/ath79_wdt.c 2013-07-14 14:25:40.810848422 +0200
11 @@ -103,10 +103,14 @@
12
13 static int ath79_wdt_set_timeout(int val)
14 {
15 - if (val < 1 || val > max_timeout)
16 + if (val < 1)
17 return -EINVAL;
18
19 - timeout = val;
20 + if (val > max_timeout)
21 + timeout = max_timeout;
22 + else
23 + timeout = val;
24 +
25 ath79_wdt_keepalive();
26
27 return 0;