From e46092e03ac049660d2eb5bf0c4e3cb7ed2ce03d Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Fri, 10 Aug 2018 14:54:22 +0100 Subject: [PATCH] qemu: Do not try and generate invalid RTC parameters If no RTC is specified in the config then do not generate any RTC command line options. RTC command line options are optional for QEMU so make Valid() return false when presented with the empty version of the RTC struct containing empty strings. Signed-off-by: Rob Bradford --- qemu/qemu.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/qemu/qemu.go b/qemu/qemu.go index 31254231d2..1337b8af25 100644 --- a/qemu/qemu.go +++ b/qemu/qemu.go @@ -1064,16 +1064,12 @@ type RTC struct { // Valid returns true if the RTC structure is valid and complete. func (rtc RTC) Valid() bool { - if rtc.Clock != "" { - if rtc.Clock != Host && rtc.Clock != VM { - return false - } + if rtc.Clock != Host && rtc.Clock != VM { + return false } - if rtc.DriftFix != "" { - if rtc.DriftFix != Slew && rtc.DriftFix != NoDriftFix { - return false - } + if rtc.DriftFix != Slew && rtc.DriftFix != NoDriftFix { + return false } return true