[PATCH 35/67] KVM: SVM: Clean up return handling in avic_pi_update_irte()
From: Sean Christopherson
Date: Fri Apr 04 2025 - 16:04:45 EST
Clean up the return paths for avic_pi_update_irte() now that the
refactoring dust has settled.
Opportunistically drop the pr_err() on IRTE update failures. Logging that
a failure occurred without _any_ context is quite useless.
Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
---
arch/x86/kvm/svm/avic.c | 20 +++++---------------
1 file changed, 5 insertions(+), 15 deletions(-)
diff --git a/arch/x86/kvm/svm/avic.c b/arch/x86/kvm/svm/avic.c
index dcfe908f5b98..4382ab2eaea6 100644
--- a/arch/x86/kvm/svm/avic.c
+++ b/arch/x86/kvm/svm/avic.c
@@ -817,8 +817,6 @@ int avic_pi_update_irte(struct kvm_kernel_irqfd *irqfd, struct kvm *kvm,
struct kvm_kernel_irq_routing_entry *new,
struct kvm_vcpu *vcpu, u32 vector)
{
- int ret = 0;
-
/*
* If the IRQ was affined to a different vCPU, remove the IRTE metadata
* from the *previous* vCPU's list.
@@ -848,8 +846,11 @@ int avic_pi_update_irte(struct kvm_kernel_irqfd *irqfd, struct kvm *kvm,
.is_guest_mode = true,
.vcpu_data = &vcpu_info,
};
+ int ret;
ret = irq_set_vcpu_affinity(host_irq, &pi);
+ if (ret)
+ return ret;
/**
* Here, we successfully setting up vcpu affinity in
@@ -858,20 +859,9 @@ int avic_pi_update_irte(struct kvm_kernel_irqfd *irqfd, struct kvm *kvm,
* we can reference to them directly when we update vcpu
* scheduling information in IOMMU irte.
*/
- if (!ret)
- ret = svm_ir_list_add(to_svm(vcpu), irqfd, &pi);
- } else {
- ret = irq_set_vcpu_affinity(host_irq, NULL);
+ return svm_ir_list_add(to_svm(vcpu), irqfd, &pi);
}
-
- if (ret < 0) {
- pr_err("%s: failed to update PI IRTE\n", __func__);
- goto out;
- }
-
- ret = 0;
-out:
- return ret;
+ return irq_set_vcpu_affinity(host_irq, NULL);
}
static inline int
--
2.49.0.504.g3bcea36a83-goog