From cd5d8c8da71e52a08079c3be52a352881eabcf94 Mon Sep 17 00:00:00 2001 From: Minggui Cao Date: Wed, 30 May 2018 15:37:52 +0800 Subject: [PATCH] check UART valid or not when setup console timer if no valid UART in hypervisor, not need setup console timer. Signed-off-by: Minggui Cao --- hypervisor/debug/console.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hypervisor/debug/console.c b/hypervisor/debug/console.c index 4994612fe..d959baea0 100644 --- a/hypervisor/debug/console.c +++ b/hypervisor/debug/console.c @@ -201,6 +201,12 @@ void console_setup_timer(void) static struct timer console_timer; uint64_t period_in_cycle, fire_tsc; + if (serial_handle == SERIAL_INVALID_HANDLE) { + pr_err("%s: no uart, not need setup console timer", + __func__); + return; + } + period_in_cycle = CYCLES_PER_MS * CONSOLE_KICK_TIMER_TIMEOUT; fire_tsc = rdtsc() + period_in_cycle; initialize_timer(&console_timer,