From b797c98de4106b0d8cd1daa7d32f31e47e9f1d46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Tue, 20 Jun 2023 07:18:12 +0200 Subject: hw/i386: Remove unuseful kvmclock_create() stub MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We shouldn't call kvmclock_create() when KVM is not available or disabled: - check for kvm_enabled() before calling it - assert KVM is enabled once called Since the call is elided when KVM is not available, we can remove the stub (it is never compiled). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Alex Bennée Message-Id: <20230620083228.88796-2-philmd@linaro.org> --- hw/i386/kvm/clock.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'hw/i386/kvm') diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c index df70b4a..0824c6d 100644 --- a/hw/i386/kvm/clock.c +++ b/hw/i386/kvm/clock.c @@ -332,8 +332,10 @@ void kvmclock_create(bool create_always) { X86CPU *cpu = X86_CPU(first_cpu); - if (!kvm_enabled() || !kvm_has_adjust_clock()) + assert(kvm_enabled()); + if (!kvm_has_adjust_clock()) { return; + } if (create_always || cpu->env.features[FEAT_KVM] & ((1ULL << KVM_FEATURE_CLOCKSOURCE) | -- cgit v1.1