0002-watchdog-ath79-fix-maximum-timeout.patch 974 B

12345678910111213141516171819202122232425262728293031323334353637
  1. From 5f5c9858af167f842ee8df053920b98387a71af1 Mon Sep 17 00:00:00 2001
  2. From: John Crispin <[email protected]>
  3. Date: Mon, 5 Mar 2018 11:41:25 +0100
  4. Subject: [PATCH 02/27] watchdog: ath79: fix maximum timeout
  5. If the userland tries to set a timeout higher than the max_timeout,
  6. then we should fallback to max_timeout.
  7. Signed-off-by: John Crispin <[email protected]>
  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 e2209bf5fa8a..c2fc6c3d0092 100644
  13. --- a/drivers/watchdog/ath79_wdt.c
  14. +++ b/drivers/watchdog/ath79_wdt.c
  15. @@ -115,10 +115,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. 2.11.0