watchdog/aspeed: fix variable type to store reload value
PATCH 1/1 watchdog/aspeed: fix variable type to store reload value
Initially from Anton D. Kachalov" <[email protected]> but the SoB was missing.
Signed-off-by Cédric Le Goater <[email protected]>
[clg: change commit log and subject]
--- hw/watchdog/wdt_aspeed.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/watchdog/wdt_aspeed.c +2 -2
@@ -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)) {
Signature · 1 line
2.13.5
hw/watchdog/wdt_aspeed.c static uint64_t aspeed_wdt_read(void *opaque, hwaddr offset, unsigned size) · line 109
Quoted 8 lines · Cédric Le Goater
hw/watchdog/wdt_aspeed.c +2
-1+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~
Quoted 11 lines · Richard Henderson
hw/watchdog/wdt_aspeed.c static uint64_t aspeed_wdt_read(void *opaque, hwaddr offset, unsigned size) · line 109
Quoted 8 lines · Cédric Le Goater
hw/watchdog/wdt_aspeed.c +2
-1+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.