Commit 3322d53f authored by Mike Crowe's avatar Mike Crowe Committed by Wim Van Sebroeck
Browse files

watchdog: sp805: Report correct timeleft at maximum



sp805_wdt::load_val is of type unsigned int. When the interrupt is
inactive wdt_timeleft adds one to the value, and then adds that to the
value used to calculate the time remaining. Unfortunately it's not
unlikely that load_val contains LOAD_MAX, which is 0xFFFFFFFF and wraps
to zero when one is added to it, resulting in the time left being
understated by about 21.7s. Fix this by ensuring the addition happens as
64-bit.

Signed-off-by: default avatarMike Crowe <mac@mcrowe.com>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20241203095744.3001795-1-mac@mcrowe.com


Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarWim Van Sebroeck <wim@linux-watchdog.org>
parent 6a569e29
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment