Message ID | 20170919111721.7931-1-clg@kaod.org |
---|---|
State | New |
Headers | show |
Series | watchdog/aspeed: fix variable type to store reload value | expand |
On 09/19/2017 06:17 AM, Cédric Le Goater wrote: > + uint64_t reload; > > if (pclk) { > reload = muldiv64(s->regs[WDT_RELOAD_VALUE], NANOSECONDS_PER_SECOND, > s->pclk_freq); > } else { > - reload = s->regs[WDT_RELOAD_VALUE] * 1000; > + reload = s->regs[WDT_RELOAD_VALUE] * 1000UL; UL does not help ilp32 hosts. Need ULL or an explicit cast. r~
On 09/19/2017 07:15 PM, Richard Henderson wrote: > On 09/19/2017 06:17 AM, Cédric Le Goater wrote: >> + uint64_t reload; >> >> if (pclk) { >> reload = muldiv64(s->regs[WDT_RELOAD_VALUE], NANOSECONDS_PER_SECOND, >> s->pclk_freq); >> } else { >> - reload = s->regs[WDT_RELOAD_VALUE] * 1000; >> + reload = s->regs[WDT_RELOAD_VALUE] * 1000UL; > > UL does not help ilp32 hosts. Need ULL or an explicit cast. ok. I will send a fix. Thanks, C.
diff --git a/hw/watchdog/wdt_aspeed.c b/hw/watchdog/wdt_aspeed.c index 22bce364d7b5..b8e0e9a75999 100644 --- a/hw/watchdog/wdt_aspeed.c +++ b/hw/watchdog/wdt_aspeed.c @@ -100,13 +100,13 @@ static uint64_t aspeed_wdt_read(void *opaque, hwaddr offset, unsigned size) static void aspeed_wdt_reload(AspeedWDTState *s, bool pclk) { - uint32_t reload; + uint64_t reload; if (pclk) { reload = muldiv64(s->regs[WDT_RELOAD_VALUE], NANOSECONDS_PER_SECOND, s->pclk_freq); } else { - reload = s->regs[WDT_RELOAD_VALUE] * 1000; + reload = s->regs[WDT_RELOAD_VALUE] * 1000UL; } if (aspeed_wdt_is_enabled(s)) {
Initially from Anton D. Kachalov" <mouse@yandex-team.ru> but the SoB was missing. Signed-off-by: Cédric Le Goater <clg@kaod.org> [clg: change commit log and subject] --- hw/watchdog/wdt_aspeed.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)