summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTao Ren <rentao.bupt@gmail.com>2021-04-16 20:42:49 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-07-20 16:21:14 +0200
commitae0d3b65e2d306d15a4fd34ad2634f6d5e86eb3f (patch)
treeb494e74122c9ba87d628bde20ff178c42e2ba43f
parent558fe7c3c6ddb21dd7d74c0dad07b37129b6edeb (diff)
downloadlinux-stable-ae0d3b65e2d306d15a4fd34ad2634f6d5e86eb3f.tar.gz
linux-stable-ae0d3b65e2d306d15a4fd34ad2634f6d5e86eb3f.tar.bz2
linux-stable-ae0d3b65e2d306d15a4fd34ad2634f6d5e86eb3f.zip
watchdog: aspeed: fix hardware timeout calculation
[ Upstream commit e7dc481c92060f9ce872878b0b7a08c24713a7e5 ] Fix hardware timeout calculation in aspeed_wdt_set_timeout function to ensure the reload value does not exceed the hardware limit. Fixes: efa859f7d786 ("watchdog: Add Aspeed watchdog driver") Reported-by: Amithash Prasad <amithash@fb.com> Signed-off-by: Tao Ren <rentao.bupt@gmail.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20210417034249.5978-1-rentao.bupt@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/watchdog/aspeed_wdt.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/watchdog/aspeed_wdt.c b/drivers/watchdog/aspeed_wdt.c
index f5ad8023c2e6..1c47e6345b57 100644
--- a/drivers/watchdog/aspeed_wdt.c
+++ b/drivers/watchdog/aspeed_wdt.c
@@ -100,7 +100,7 @@ static int aspeed_wdt_set_timeout(struct watchdog_device *wdd,
wdd->timeout = timeout;
- actual = min(timeout, wdd->max_hw_heartbeat_ms * 1000);
+ actual = min(timeout, wdd->max_hw_heartbeat_ms / 1000);
writel(actual * WDT_RATE_1MHZ, wdt->base + WDT_RELOAD_VALUE);
writel(WDT_RESTART_MAGIC, wdt->base + WDT_RESTART);