]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
KVM: arm64: Clean up KVM_SET_GUEST_DEBUG handler
authorOliver Upton <oliver.upton@linux.dev>
Thu, 19 Dec 2024 22:41:04 +0000 (14:41 -0800)
committerMarc Zyngier <maz@kernel.org>
Fri, 20 Dec 2024 09:01:25 +0000 (09:01 +0000)
No particular reason other than it isn't nice to look at.

Tested-by: James Clark <james.clark@linaro.org>
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
Link: https://lore.kernel.org/r/20241219224116.3941496-8-oliver.upton@linux.dev
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/kvm/guest.c

index 12dad841f2a51276eee4d4da7400c1b2a5732ff8..1fe097c67766d49efd122b80382fda569a47a589 100644 (file)
@@ -917,31 +917,24 @@ int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu,
 int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
                                        struct kvm_guest_debug *dbg)
 {
-       int ret = 0;
-
        trace_kvm_set_guest_debug(vcpu, dbg->control);
 
-       if (dbg->control & ~KVM_GUESTDBG_VALID_MASK) {
-               ret = -EINVAL;
-               goto out;
-       }
-
-       if (dbg->control & KVM_GUESTDBG_ENABLE) {
-               vcpu->guest_debug = dbg->control;
-
-               /* Hardware assisted Break and Watch points */
-               if (vcpu->guest_debug & KVM_GUESTDBG_USE_HW) {
-                       vcpu->arch.external_debug_state = dbg->arch;
-               }
+       if (dbg->control & ~KVM_GUESTDBG_VALID_MASK)
+               return -EINVAL;
 
-       } else {
-               /* If not enabled clear all flags */
+       if (!(dbg->control & KVM_GUESTDBG_ENABLE)) {
                vcpu->guest_debug = 0;
                vcpu_clear_flag(vcpu, DBG_SS_ACTIVE_PENDING);
+               return 0;
        }
 
-out:
-       return ret;
+       vcpu->guest_debug = dbg->control;
+
+       /* Hardware assisted Break and Watch points */
+       if (vcpu->guest_debug & KVM_GUESTDBG_USE_HW)
+               vcpu->arch.external_debug_state = dbg->arch;
+
+       return 0;
 }
 
 int kvm_arm_vcpu_arch_set_attr(struct kvm_vcpu *vcpu,