Skip to contentSkip to conversation

KVM: arm64: get rid of var ret and out jump label in kvm_arch_vcpu_ioctl_set_guest_debug()

PATCH linmiaohe 2 participants 2 messages Jan 14, 2020 – Jan 15, 2020

Subsystems (2)
lore
Share & tools
lore

linmiaohe

author
#0 lore raw

Friendly ping :)

Quoted 40 lines

From: Miaohe Lin <[email protected]>

The var ret and out jump label is not really needed. Clean them up.

---
 arch/arm64/kvm/guest.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
arch/arm64/kvm/guest.c +3 -9
@@ -834,14 +834,10 @@ 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_VALID_MASK)
+		return -EINVAL;
 
 	if (dbg->control & KVM_GUESTDBG_ENABLE) {
 		vcpu->guest_debug = dbg->control;
@@ -856,8 +852,7 @@ int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
 		vcpu->guest_debug = 0;
 	}
 
-out:
-	return ret;
+	return 0;
 }
 
 int kvm_arm_vcpu_arch_set_attr(struct kvm_vcpu *vcpu,
--

2.19.1

maintainer
#1 lore raw
Quoted 1 line · linmiaohe

Friendly ping :)

Friendly reply:

Quoted 33 lines
Quoted 33 lines

From: Miaohe Lin <[email protected]>

The var ret and out jump label is not really needed. Clean them up.

---
 arch/arm64/kvm/guest.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
arch/arm64/kvm/guest.c +2 -6
@@ -834,14 +834,10 @@ 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_VALID_MASK)
+		return -EINVAL;
 
 	if (dbg->control & KVM_GUESTDBG_ENABLE) {
 		vcpu->guest_debug = dbg->control;
@@ -856,8 +852,7 @@ int kvm_arch_vcpu_ioctl_set_guest_debug(struct 
 kvm_vcpu *vcpu,
 		vcpu->guest_debug = 0;
 	}
 
Quoted 3 lines

arch/arm64/kvm/guest.c int kvm_arch_vcpu_ioctl_set_guest_debug(struct · line 856

Quoted 3 lines
arch/arm64/kvm/guest.c +1 -2
-out:
-	return ret;
+	return 0;

I don't think there is anything wrong with the existing code. It may not be to your own taste, but is in keeping with a lot of the KVM code.

If you were making changes to this code, I wouldn't object. But on its own, this is just churn.

Thanks,

        M.
Signature · 6 lines
Jazz is not dead. It just smells funny...

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel