1
0

0017-MIPS-ath79-fix-maximum-timeout.patch 952 B

12345678910111213141516171819202122232425262728293031323334353637
  1. From 54d01581baa903adb8515625d98652ed43efba36 Mon Sep 17 00:00:00 2001
  2. From: Phil Sutter <phil@nwl.cc>
  3. Date: Tue, 13 May 2014 01:21:59 +0200
  4. Subject: [PATCH] MIPS: ath79: fix maximum timeout
  5. If the userland tries to set a timeout higher than the max_timeout, then
  6. we should fallback to max_timeout.
  7. Signed-off-by: John Crispin <blogic@openwrt.org>
  8. ---
  9. drivers/watchdog/ath79_wdt.c | 8 ++++++--
  10. 1 file changed, 6 insertions(+), 2 deletions(-)
  11. diff --git a/drivers/watchdog/ath79_wdt.c b/drivers/watchdog/ath79_wdt.c
  12. index 9fa1f69..bf26baf 100644
  13. --- a/drivers/watchdog/ath79_wdt.c
  14. +++ b/drivers/watchdog/ath79_wdt.c
  15. @@ -105,10 +105,14 @@ static inline void ath79_wdt_disable(void)
  16. static int ath79_wdt_set_timeout(int val)
  17. {
  18. - if (val < 1 || val > max_timeout)
  19. + if (val < 1)
  20. return -EINVAL;
  21. - timeout = val;
  22. + if (val > max_timeout)
  23. + timeout = max_timeout;
  24. + else
  25. + timeout = val;
  26. +
  27. ath79_wdt_keepalive();
  28. return 0;
  29. --
  30. 1.8.5.3