611-MIPS-ath79-wdt-timeout.patch 580 B

12345678910111213141516171819202122232425
  1. MIPS: ath79: fix maximum timeout
  2. If the userland tries to set a timeout higher than the max_timeout, then we should fallback to max_timeout.
  3. Signed-off-by: John Crispin <blogic@openwrt.org>
  4. --- a/drivers/watchdog/ath79_wdt.c
  5. +++ b/drivers/watchdog/ath79_wdt.c
  6. @@ -114,10 +114,14 @@ static inline void ath79_wdt_disable(voi
  7. static int ath79_wdt_set_timeout(int val)
  8. {
  9. - if (val < 1 || val > max_timeout)
  10. + if (val < 1)
  11. return -EINVAL;
  12. - timeout = val;
  13. + if (val > max_timeout)
  14. + timeout = max_timeout;
  15. + else
  16. + timeout = val;
  17. +
  18. ath79_wdt_keepalive();
  19. return 0;