The function returns early at the top if CPU_BASED_TPR_SHADOW is not set in vmcs12, so any code that reaches the warn_on_missed_cc block is guaranteed to have CPU_BASED_TPR_SHADOW set. The repeated check in the if condition is always true and can be dropped. Signed-off-by: Peng Hao --- arch/x86/kvm/vmx/nested.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c index 151873407abd..a1f8adefbe35 100644 --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -619,7 +619,6 @@ static int nested_vmx_check_tpr_shadow_controls(struct kvm_vcpu *vcpu, * if userspace hasn't yet configured memslots during state restore. */ if (warn_on_missed_cc && vcpu->wants_to_run && - nested_cpu_has(vmcs12, CPU_BASED_TPR_SHADOW) && !nested_cpu_has_vid(vmcs12) && !nested_cpu_has2(vmcs12, SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES) && !kvm_read_guest(vcpu->kvm, vtpr_gpa, &vtpr, sizeof(vtpr)) && -- 2.43.7