Skip to content

Commit

Permalink
watchdog: aspeed: fix hardware timeout calculation
Browse files Browse the repository at this point in the history
[ Upstream commit e7dc481 ]

Fix hardware timeout calculation in aspeed_wdt_set_timeout function to
ensure the reload value does not exceed the hardware limit.

Fixes: efa859f ("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>
  • Loading branch information
tao-ren authored and gregkh committed Jul 20, 2021
1 parent 412ef73 commit 3b93d52
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/watchdog/aspeed_wdt.c
Expand Up @@ -147,7 +147,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);
Expand Down

0 comments on commit 3b93d52

Please sign in to comment.