There could be a corner case were-in the timeout value calculated will become way to less than the calculated value since we are rounding down the timeout value from 64-bit to 32-bit. To avoid hitting such cases, make sure to program the timeout value to be UINT_MAX if the timeout value is greater than UINT_MAX and the imeplementation is sbsa watchdog revision 0. Fixes: abd3ac7902fb ("watchdog: sbsa: Support architecture version 1") Signed-off-by: George Cherian <george.cherian@xxxxxxxxxxx> --- drivers/watchdog/sbsa_gwdt.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/watchdog/sbsa_gwdt.c b/drivers/watchdog/sbsa_gwdt.c index aaa3f5631f29..028e450ed547 100644 --- a/drivers/watchdog/sbsa_gwdt.c +++ b/drivers/watchdog/sbsa_gwdt.c @@ -135,10 +135,14 @@ static u64 sbsa_gwdt_reg_read(struct sbsa_gwdt *gwdt) static void sbsa_gwdt_reg_write(u64 val, struct sbsa_gwdt *gwdt) { - if (gwdt->version == 0) - writel((u32)val, gwdt->control_base + SBSA_GWDT_WOR); - else + if (gwdt->version == 0) { + if (val > UINT_MAX) + writel(UINT_MAX, gwdt->control_base + SBSA_GWDT_WOR); + else + writel((u32)val, gwdt->control_base + SBSA_GWDT_WOR); + } else { lo_hi_writeq(val, gwdt->control_base + SBSA_GWDT_WOR); + } } /* -- 2.34.1