Commit 807f12e5 authored by Guo Chao's avatar Guo Chao Committed by Marcelo Tosatti

KVM: remove unnecessary return value check

No need to check return value before breaking switch.
Signed-off-by: default avatarGuo Chao <yan@linux.vnet.ibm.com>
Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
parent 951179ce
...@@ -2696,9 +2696,6 @@ long kvm_arch_vcpu_ioctl(struct file *filp, ...@@ -2696,9 +2696,6 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
return PTR_ERR(u.lapic); return PTR_ERR(u.lapic);
r = kvm_vcpu_ioctl_set_lapic(vcpu, u.lapic); r = kvm_vcpu_ioctl_set_lapic(vcpu, u.lapic);
if (r)
goto out;
r = 0;
break; break;
} }
case KVM_INTERRUPT: { case KVM_INTERRUPT: {
...@@ -2708,16 +2705,10 @@ long kvm_arch_vcpu_ioctl(struct file *filp, ...@@ -2708,16 +2705,10 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
if (copy_from_user(&irq, argp, sizeof irq)) if (copy_from_user(&irq, argp, sizeof irq))
goto out; goto out;
r = kvm_vcpu_ioctl_interrupt(vcpu, &irq); r = kvm_vcpu_ioctl_interrupt(vcpu, &irq);
if (r)
goto out;
r = 0;
break; break;
} }
case KVM_NMI: { case KVM_NMI: {
r = kvm_vcpu_ioctl_nmi(vcpu); r = kvm_vcpu_ioctl_nmi(vcpu);
if (r)
goto out;
r = 0;
break; break;
} }
case KVM_SET_CPUID: { case KVM_SET_CPUID: {
...@@ -2728,8 +2719,6 @@ long kvm_arch_vcpu_ioctl(struct file *filp, ...@@ -2728,8 +2719,6 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
if (copy_from_user(&cpuid, cpuid_arg, sizeof cpuid)) if (copy_from_user(&cpuid, cpuid_arg, sizeof cpuid))
goto out; goto out;
r = kvm_vcpu_ioctl_set_cpuid(vcpu, &cpuid, cpuid_arg->entries); r = kvm_vcpu_ioctl_set_cpuid(vcpu, &cpuid, cpuid_arg->entries);
if (r)
goto out;
break; break;
} }
case KVM_SET_CPUID2: { case KVM_SET_CPUID2: {
...@@ -2741,8 +2730,6 @@ long kvm_arch_vcpu_ioctl(struct file *filp, ...@@ -2741,8 +2730,6 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
goto out; goto out;
r = kvm_vcpu_ioctl_set_cpuid2(vcpu, &cpuid, r = kvm_vcpu_ioctl_set_cpuid2(vcpu, &cpuid,
cpuid_arg->entries); cpuid_arg->entries);
if (r)
goto out;
break; break;
} }
case KVM_GET_CPUID2: { case KVM_GET_CPUID2: {
...@@ -3207,8 +3194,6 @@ long kvm_arch_vm_ioctl(struct file *filp, ...@@ -3207,8 +3194,6 @@ long kvm_arch_vm_ioctl(struct file *filp,
switch (ioctl) { switch (ioctl) {
case KVM_SET_TSS_ADDR: case KVM_SET_TSS_ADDR:
r = kvm_vm_ioctl_set_tss_addr(kvm, arg); r = kvm_vm_ioctl_set_tss_addr(kvm, arg);
if (r < 0)
goto out;
break; break;
case KVM_SET_IDENTITY_MAP_ADDR: { case KVM_SET_IDENTITY_MAP_ADDR: {
u64 ident_addr; u64 ident_addr;
...@@ -3217,14 +3202,10 @@ long kvm_arch_vm_ioctl(struct file *filp, ...@@ -3217,14 +3202,10 @@ long kvm_arch_vm_ioctl(struct file *filp,
if (copy_from_user(&ident_addr, argp, sizeof ident_addr)) if (copy_from_user(&ident_addr, argp, sizeof ident_addr))
goto out; goto out;
r = kvm_vm_ioctl_set_identity_map_addr(kvm, ident_addr); r = kvm_vm_ioctl_set_identity_map_addr(kvm, ident_addr);
if (r < 0)
goto out;
break; break;
} }
case KVM_SET_NR_MMU_PAGES: case KVM_SET_NR_MMU_PAGES:
r = kvm_vm_ioctl_set_nr_mmu_pages(kvm, arg); r = kvm_vm_ioctl_set_nr_mmu_pages(kvm, arg);
if (r)
goto out;
break; break;
case KVM_GET_NR_MMU_PAGES: case KVM_GET_NR_MMU_PAGES:
r = kvm_vm_ioctl_get_nr_mmu_pages(kvm); r = kvm_vm_ioctl_get_nr_mmu_pages(kvm);
...@@ -3315,8 +3296,6 @@ long kvm_arch_vm_ioctl(struct file *filp, ...@@ -3315,8 +3296,6 @@ long kvm_arch_vm_ioctl(struct file *filp,
r = 0; r = 0;
get_irqchip_out: get_irqchip_out:
kfree(chip); kfree(chip);
if (r)
goto out;
break; break;
} }
case KVM_SET_IRQCHIP: { case KVM_SET_IRQCHIP: {
...@@ -3338,8 +3317,6 @@ long kvm_arch_vm_ioctl(struct file *filp, ...@@ -3338,8 +3317,6 @@ long kvm_arch_vm_ioctl(struct file *filp,
r = 0; r = 0;
set_irqchip_out: set_irqchip_out:
kfree(chip); kfree(chip);
if (r)
goto out;
break; break;
} }
case KVM_GET_PIT: { case KVM_GET_PIT: {
...@@ -3366,9 +3343,6 @@ long kvm_arch_vm_ioctl(struct file *filp, ...@@ -3366,9 +3343,6 @@ long kvm_arch_vm_ioctl(struct file *filp,
if (!kvm->arch.vpit) if (!kvm->arch.vpit)
goto out; goto out;
r = kvm_vm_ioctl_set_pit(kvm, &u.ps); r = kvm_vm_ioctl_set_pit(kvm, &u.ps);
if (r)
goto out;
r = 0;
break; break;
} }
case KVM_GET_PIT2: { case KVM_GET_PIT2: {
...@@ -3392,9 +3366,6 @@ long kvm_arch_vm_ioctl(struct file *filp, ...@@ -3392,9 +3366,6 @@ long kvm_arch_vm_ioctl(struct file *filp,
if (!kvm->arch.vpit) if (!kvm->arch.vpit)
goto out; goto out;
r = kvm_vm_ioctl_set_pit2(kvm, &u.ps2); r = kvm_vm_ioctl_set_pit2(kvm, &u.ps2);
if (r)
goto out;
r = 0;
break; break;
} }
case KVM_REINJECT_CONTROL: { case KVM_REINJECT_CONTROL: {
...@@ -3403,9 +3374,6 @@ long kvm_arch_vm_ioctl(struct file *filp, ...@@ -3403,9 +3374,6 @@ long kvm_arch_vm_ioctl(struct file *filp,
if (copy_from_user(&control, argp, sizeof(control))) if (copy_from_user(&control, argp, sizeof(control)))
goto out; goto out;
r = kvm_vm_ioctl_reinject(kvm, &control); r = kvm_vm_ioctl_reinject(kvm, &control);
if (r)
goto out;
r = 0;
break; break;
} }
case KVM_XEN_HVM_CONFIG: { case KVM_XEN_HVM_CONFIG: {
......
...@@ -1929,10 +1929,6 @@ static long kvm_vcpu_ioctl(struct file *filp, ...@@ -1929,10 +1929,6 @@ static long kvm_vcpu_ioctl(struct file *filp,
goto out; goto out;
} }
r = kvm_arch_vcpu_ioctl_set_regs(vcpu, kvm_regs); r = kvm_arch_vcpu_ioctl_set_regs(vcpu, kvm_regs);
if (r)
goto out_free2;
r = 0;
out_free2:
kfree(kvm_regs); kfree(kvm_regs);
break; break;
} }
...@@ -1958,9 +1954,6 @@ static long kvm_vcpu_ioctl(struct file *filp, ...@@ -1958,9 +1954,6 @@ static long kvm_vcpu_ioctl(struct file *filp,
goto out; goto out;
} }
r = kvm_arch_vcpu_ioctl_set_sregs(vcpu, kvm_sregs); r = kvm_arch_vcpu_ioctl_set_sregs(vcpu, kvm_sregs);
if (r)
goto out;
r = 0;
break; break;
} }
case KVM_GET_MP_STATE: { case KVM_GET_MP_STATE: {
...@@ -1982,9 +1975,6 @@ static long kvm_vcpu_ioctl(struct file *filp, ...@@ -1982,9 +1975,6 @@ static long kvm_vcpu_ioctl(struct file *filp,
if (copy_from_user(&mp_state, argp, sizeof mp_state)) if (copy_from_user(&mp_state, argp, sizeof mp_state))
goto out; goto out;
r = kvm_arch_vcpu_ioctl_set_mpstate(vcpu, &mp_state); r = kvm_arch_vcpu_ioctl_set_mpstate(vcpu, &mp_state);
if (r)
goto out;
r = 0;
break; break;
} }
case KVM_TRANSLATE: { case KVM_TRANSLATE: {
...@@ -2009,9 +1999,6 @@ static long kvm_vcpu_ioctl(struct file *filp, ...@@ -2009,9 +1999,6 @@ static long kvm_vcpu_ioctl(struct file *filp,
if (copy_from_user(&dbg, argp, sizeof dbg)) if (copy_from_user(&dbg, argp, sizeof dbg))
goto out; goto out;
r = kvm_arch_vcpu_ioctl_set_guest_debug(vcpu, &dbg); r = kvm_arch_vcpu_ioctl_set_guest_debug(vcpu, &dbg);
if (r)
goto out;
r = 0;
break; break;
} }
case KVM_SET_SIGNAL_MASK: { case KVM_SET_SIGNAL_MASK: {
...@@ -2059,9 +2046,6 @@ static long kvm_vcpu_ioctl(struct file *filp, ...@@ -2059,9 +2046,6 @@ static long kvm_vcpu_ioctl(struct file *filp,
goto out; goto out;
} }
r = kvm_arch_vcpu_ioctl_set_fpu(vcpu, fpu); r = kvm_arch_vcpu_ioctl_set_fpu(vcpu, fpu);
if (r)
goto out;
r = 0;
break; break;
} }
default: default:
...@@ -2131,8 +2115,6 @@ static long kvm_vm_ioctl(struct file *filp, ...@@ -2131,8 +2115,6 @@ static long kvm_vm_ioctl(struct file *filp,
switch (ioctl) { switch (ioctl) {
case KVM_CREATE_VCPU: case KVM_CREATE_VCPU:
r = kvm_vm_ioctl_create_vcpu(kvm, arg); r = kvm_vm_ioctl_create_vcpu(kvm, arg);
if (r < 0)
goto out;
break; break;
case KVM_SET_USER_MEMORY_REGION: { case KVM_SET_USER_MEMORY_REGION: {
struct kvm_userspace_memory_region kvm_userspace_mem; struct kvm_userspace_memory_region kvm_userspace_mem;
...@@ -2143,8 +2125,6 @@ static long kvm_vm_ioctl(struct file *filp, ...@@ -2143,8 +2125,6 @@ static long kvm_vm_ioctl(struct file *filp,
goto out; goto out;
r = kvm_vm_ioctl_set_memory_region(kvm, &kvm_userspace_mem, 1); r = kvm_vm_ioctl_set_memory_region(kvm, &kvm_userspace_mem, 1);
if (r)
goto out;
break; break;
} }
case KVM_GET_DIRTY_LOG: { case KVM_GET_DIRTY_LOG: {
...@@ -2154,8 +2134,6 @@ static long kvm_vm_ioctl(struct file *filp, ...@@ -2154,8 +2134,6 @@ static long kvm_vm_ioctl(struct file *filp,
if (copy_from_user(&log, argp, sizeof log)) if (copy_from_user(&log, argp, sizeof log))
goto out; goto out;
r = kvm_vm_ioctl_get_dirty_log(kvm, &log); r = kvm_vm_ioctl_get_dirty_log(kvm, &log);
if (r)
goto out;
break; break;
} }
#ifdef KVM_COALESCED_MMIO_PAGE_OFFSET #ifdef KVM_COALESCED_MMIO_PAGE_OFFSET
...@@ -2165,9 +2143,6 @@ static long kvm_vm_ioctl(struct file *filp, ...@@ -2165,9 +2143,6 @@ static long kvm_vm_ioctl(struct file *filp,
if (copy_from_user(&zone, argp, sizeof zone)) if (copy_from_user(&zone, argp, sizeof zone))
goto out; goto out;
r = kvm_vm_ioctl_register_coalesced_mmio(kvm, &zone); r = kvm_vm_ioctl_register_coalesced_mmio(kvm, &zone);
if (r)
goto out;
r = 0;
break; break;
} }
case KVM_UNREGISTER_COALESCED_MMIO: { case KVM_UNREGISTER_COALESCED_MMIO: {
...@@ -2176,9 +2151,6 @@ static long kvm_vm_ioctl(struct file *filp, ...@@ -2176,9 +2151,6 @@ static long kvm_vm_ioctl(struct file *filp,
if (copy_from_user(&zone, argp, sizeof zone)) if (copy_from_user(&zone, argp, sizeof zone))
goto out; goto out;
r = kvm_vm_ioctl_unregister_coalesced_mmio(kvm, &zone); r = kvm_vm_ioctl_unregister_coalesced_mmio(kvm, &zone);
if (r)
goto out;
r = 0;
break; break;
} }
#endif #endif
...@@ -2287,8 +2259,6 @@ static long kvm_vm_compat_ioctl(struct file *filp, ...@@ -2287,8 +2259,6 @@ static long kvm_vm_compat_ioctl(struct file *filp,
log.dirty_bitmap = compat_ptr(compat_log.dirty_bitmap); log.dirty_bitmap = compat_ptr(compat_log.dirty_bitmap);
r = kvm_vm_ioctl_get_dirty_log(kvm, &log); r = kvm_vm_ioctl_get_dirty_log(kvm, &log);
if (r)
goto out;
break; break;
} }
default: default:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment