diff options
author | Simon Glass <sjg@chromium.org> | 2021-01-14 06:29:45 +0300 |
---|---|---|
committer | Bin Meng <bmeng.cn@gmail.com> | 2021-02-01 10:11:40 +0300 |
commit | 9edf20f15649cda83214b3b6dc90ca9acff45abb (patch) | |
tree | b61e17db1d0ee07f09427a3fe82a71f07c2fbd82 | |
parent | 12218c1ff41befedd78ed8cfa902f2cc25d05c88 (diff) | |
download | u-boot-9edf20f15649cda83214b3b6dc90ca9acff45abb.tar.xz |
x86: tsc_timer: Correct overflow in __udelay()
At present long delays such as msleep(2000) can cause an overflow in this
function. There is no need for this, since it already uses a 64-bit int.
Add a cast to correct this.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
-rw-r--r-- | drivers/timer/tsc_timer.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/timer/tsc_timer.c b/drivers/timer/tsc_timer.c index 706d52b830..7d0fc66cc7 100644 --- a/drivers/timer/tsc_timer.c +++ b/drivers/timer/tsc_timer.c @@ -372,7 +372,7 @@ void __udelay(unsigned long usec) u64 now = get_ticks(); u64 stop; - stop = now + usec * get_tbclk_mhz(); + stop = now + (u64)usec * get_tbclk_mhz(); while ((int64_t)(stop - get_ticks()) > 0) #if defined(CONFIG_QEMU) && defined(CONFIG_SMP) |