aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuo Chao <yan@linux.vnet.ibm.com>2012-11-02 06:33:23 -0400
committerMarcelo Tosatti <mtosatti@redhat.com>2012-11-13 19:14:29 -0500
commit807f12e57c9783458b8c07f63eff3c3e1df8ab5d (patch)
tree7560f5d4fb19bf4637b59f926eda4512232a921e
parent951179ce86f5599e2dfb9de254056e91bd865f15 (diff)
KVM: remove unnecessary return value check
No need to check return value before breaking switch. Signed-off-by: Guo Chao <yan@linux.vnet.ibm.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
-rw-r--r--arch/x86/kvm/x86.c32
-rw-r--r--virt/kvm/kvm_main.c30
2 files changed, 0 insertions, 62 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index a25b3df8e3e1..c31f75dd24d4 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2696,9 +2696,6 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
2696 return PTR_ERR(u.lapic); 2696 return PTR_ERR(u.lapic);
2697 2697
2698 r = kvm_vcpu_ioctl_set_lapic(vcpu, u.lapic); 2698 r = kvm_vcpu_ioctl_set_lapic(vcpu, u.lapic);
2699 if (r)
2700 goto out;
2701 r = 0;
2702 break; 2699 break;
2703 } 2700 }
2704 case KVM_INTERRUPT: { 2701 case KVM_INTERRUPT: {
@@ -2708,16 +2705,10 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
2708 if (copy_from_user(&irq, argp, sizeof irq)) 2705 if (copy_from_user(&irq, argp, sizeof irq))
2709 goto out; 2706 goto out;
2710 r = kvm_vcpu_ioctl_interrupt(vcpu, &irq); 2707 r = kvm_vcpu_ioctl_interrupt(vcpu, &irq);
2711 if (r)
2712 goto out;
2713 r = 0;
2714 break; 2708 break;
2715 } 2709 }
2716 case KVM_NMI: { 2710 case KVM_NMI: {
2717 r = kvm_vcpu_ioctl_nmi(vcpu); 2711 r = kvm_vcpu_ioctl_nmi(vcpu);
2718 if (r)
2719 goto out;
2720 r = 0;
2721 break; 2712 break;
2722 } 2713 }
2723 case KVM_SET_CPUID: { 2714 case KVM_SET_CPUID: {
@@ -2728,8 +2719,6 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
2728 if (copy_from_user(&cpuid, cpuid_arg, sizeof cpuid)) 2719 if (copy_from_user(&cpuid, cpuid_arg, sizeof cpuid))
2729 goto out; 2720 goto out;
2730 r = kvm_vcpu_ioctl_set_cpuid(vcpu, &cpuid, cpuid_arg->entries); 2721 r = kvm_vcpu_ioctl_set_cpuid(vcpu, &cpuid, cpuid_arg->entries);
2731 if (r)
2732 goto out;
2733 break; 2722 break;
2734 } 2723 }
2735 case KVM_SET_CPUID2: { 2724 case KVM_SET_CPUID2: {
@@ -2741,8 +2730,6 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
2741 goto out; 2730 goto out;
2742 r = kvm_vcpu_ioctl_set_cpuid2(vcpu, &cpuid, 2731 r = kvm_vcpu_ioctl_set_cpuid2(vcpu, &cpuid,
2743 cpuid_arg->entries); 2732 cpuid_arg->entries);
2744 if (r)
2745 goto out;
2746 break; 2733 break;
2747 } 2734 }
2748 case KVM_GET_CPUID2: { 2735 case KVM_GET_CPUID2: {
@@ -3207,8 +3194,6 @@ long kvm_arch_vm_ioctl(struct file *filp,
3207 switch (ioctl) { 3194 switch (ioctl) {
3208 case KVM_SET_TSS_ADDR: 3195 case KVM_SET_TSS_ADDR:
3209 r = kvm_vm_ioctl_set_tss_addr(kvm, arg); 3196 r = kvm_vm_ioctl_set_tss_addr(kvm, arg);
3210 if (r < 0)
3211 goto out;
3212 break; 3197 break;
3213 case KVM_SET_IDENTITY_MAP_ADDR: { 3198 case KVM_SET_IDENTITY_MAP_ADDR: {
3214 u64 ident_addr; 3199 u64 ident_addr;
@@ -3217,14 +3202,10 @@ long kvm_arch_vm_ioctl(struct file *filp,
3217 if (copy_from_user(&ident_addr, argp, sizeof ident_addr)) 3202 if (copy_from_user(&ident_addr, argp, sizeof ident_addr))
3218 goto out; 3203 goto out;
3219 r = kvm_vm_ioctl_set_identity_map_addr(kvm, ident_addr); 3204 r = kvm_vm_ioctl_set_identity_map_addr(kvm, ident_addr);
3220 if (r < 0)
3221 goto out;
3222 break; 3205 break;
3223 } 3206 }
3224 case KVM_SET_NR_MMU_PAGES: 3207 case KVM_SET_NR_MMU_PAGES:
3225 r = kvm_vm_ioctl_set_nr_mmu_pages(kvm, arg); 3208 r = kvm_vm_ioctl_set_nr_mmu_pages(kvm, arg);
3226 if (r)
3227 goto out;
3228 break; 3209 break;
3229 case KVM_GET_NR_MMU_PAGES: 3210 case KVM_GET_NR_MMU_PAGES:
3230 r = kvm_vm_ioctl_get_nr_mmu_pages(kvm); 3211 r = kvm_vm_ioctl_get_nr_mmu_pages(kvm);
@@ -3315,8 +3296,6 @@ long kvm_arch_vm_ioctl(struct file *filp,
3315 r = 0; 3296 r = 0;
3316 get_irqchip_out: 3297 get_irqchip_out:
3317 kfree(chip); 3298 kfree(chip);
3318 if (r)
3319 goto out;
3320 break; 3299 break;
3321 } 3300 }
3322 case KVM_SET_IRQCHIP: { 3301 case KVM_SET_IRQCHIP: {
@@ -3338,8 +3317,6 @@ long kvm_arch_vm_ioctl(struct file *filp,
3338 r = 0; 3317 r = 0;
3339 set_irqchip_out: 3318 set_irqchip_out:
3340 kfree(chip); 3319 kfree(chip);
3341 if (r)
3342 goto out;
3343 break; 3320 break;
3344 } 3321 }
3345 case KVM_GET_PIT: { 3322 case KVM_GET_PIT: {
@@ -3366,9 +3343,6 @@ long kvm_arch_vm_ioctl(struct file *filp,
3366 if (!kvm->arch.vpit) 3343 if (!kvm->arch.vpit)
3367 goto out; 3344 goto out;
3368 r = kvm_vm_ioctl_set_pit(kvm, &u.ps); 3345 r = kvm_vm_ioctl_set_pit(kvm, &u.ps);
3369 if (r)
3370 goto out;
3371 r = 0;
3372 break; 3346 break;
3373 } 3347 }
3374 case KVM_GET_PIT2: { 3348 case KVM_GET_PIT2: {
@@ -3392,9 +3366,6 @@ long kvm_arch_vm_ioctl(struct file *filp,
3392 if (!kvm->arch.vpit) 3366 if (!kvm->arch.vpit)
3393 goto out; 3367 goto out;
3394 r = kvm_vm_ioctl_set_pit2(kvm, &u.ps2); 3368 r = kvm_vm_ioctl_set_pit2(kvm, &u.ps2);
3395 if (r)
3396 goto out;
3397 r = 0;
3398 break; 3369 break;
3399 } 3370 }
3400 case KVM_REINJECT_CONTROL: { 3371 case KVM_REINJECT_CONTROL: {
@@ -3403,9 +3374,6 @@ long kvm_arch_vm_ioctl(struct file *filp,
3403 if (copy_from_user(&control, argp, sizeof(control))) 3374 if (copy_from_user(&control, argp, sizeof(control)))
3404 goto out; 3375 goto out;
3405 r = kvm_vm_ioctl_reinject(kvm, &control); 3376 r = kvm_vm_ioctl_reinject(kvm, &control);
3406 if (r)
3407 goto out;
3408 r = 0;
3409 break; 3377 break;
3410 } 3378 }
3411 case KVM_XEN_HVM_CONFIG: { 3379 case KVM_XEN_HVM_CONFIG: {
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 316d76aa030d..e3f5b143158e 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1929,10 +1929,6 @@ out_free1:
1929 goto out; 1929 goto out;
1930 } 1930 }
1931 r = kvm_arch_vcpu_ioctl_set_regs(vcpu, kvm_regs); 1931 r = kvm_arch_vcpu_ioctl_set_regs(vcpu, kvm_regs);
1932 if (r)
1933 goto out_free2;
1934 r = 0;
1935out_free2:
1936 kfree(kvm_regs); 1932 kfree(kvm_regs);
1937 break; 1933 break;
1938 } 1934 }
@@ -1958,9 +1954,6 @@ out_free2:
1958 goto out; 1954 goto out;
1959 } 1955 }
1960 r = kvm_arch_vcpu_ioctl_set_sregs(vcpu, kvm_sregs); 1956 r = kvm_arch_vcpu_ioctl_set_sregs(vcpu, kvm_sregs);
1961 if (r)
1962 goto out;
1963 r = 0;
1964 break; 1957 break;
1965 } 1958 }
1966 case KVM_GET_MP_STATE: { 1959 case KVM_GET_MP_STATE: {
@@ -1982,9 +1975,6 @@ out_free2:
1982 if (copy_from_user(&mp_state, argp, sizeof mp_state)) 1975 if (copy_from_user(&mp_state, argp, sizeof mp_state))
1983 goto out; 1976 goto out;
1984 r = kvm_arch_vcpu_ioctl_set_mpstate(vcpu, &mp_state); 1977 r = kvm_arch_vcpu_ioctl_set_mpstate(vcpu, &mp_state);
1985 if (r)
1986 goto out;
1987 r = 0;
1988 break; 1978 break;
1989 } 1979 }
1990 case KVM_TRANSLATE: { 1980 case KVM_TRANSLATE: {
@@ -2009,9 +1999,6 @@ out_free2:
2009 if (copy_from_user(&dbg, argp, sizeof dbg)) 1999 if (copy_from_user(&dbg, argp, sizeof dbg))
2010 goto out; 2000 goto out;
2011 r = kvm_arch_vcpu_ioctl_set_guest_debug(vcpu, &dbg); 2001 r = kvm_arch_vcpu_ioctl_set_guest_debug(vcpu, &dbg);
2012 if (r)
2013 goto out;
2014 r = 0;
2015 break; 2002 break;
2016 } 2003 }
2017 case KVM_SET_SIGNAL_MASK: { 2004 case KVM_SET_SIGNAL_MASK: {
@@ -2059,9 +2046,6 @@ out_free2:
2059 goto out; 2046 goto out;
2060 } 2047 }
2061 r = kvm_arch_vcpu_ioctl_set_fpu(vcpu, fpu); 2048 r = kvm_arch_vcpu_ioctl_set_fpu(vcpu, fpu);
2062 if (r)
2063 goto out;
2064 r = 0;
2065 break; 2049 break;
2066 } 2050 }
2067 default: 2051 default:
@@ -2131,8 +2115,6 @@ static long kvm_vm_ioctl(struct file *filp,
2131 switch (ioctl) { 2115 switch (ioctl) {
2132 case KVM_CREATE_VCPU: 2116 case KVM_CREATE_VCPU:
2133 r = kvm_vm_ioctl_create_vcpu(kvm, arg); 2117 r = kvm_vm_ioctl_create_vcpu(kvm, arg);
2134 if (r < 0)
2135 goto out;
2136 break; 2118 break;
2137 case KVM_SET_USER_MEMORY_REGION: { 2119 case KVM_SET_USER_MEMORY_REGION: {
2138 struct kvm_userspace_memory_region kvm_userspace_mem; 2120 struct kvm_userspace_memory_region kvm_userspace_mem;
@@ -2143,8 +2125,6 @@ static long kvm_vm_ioctl(struct file *filp,
2143 goto out; 2125 goto out;
2144 2126
2145 r = kvm_vm_ioctl_set_memory_region(kvm, &kvm_userspace_mem, 1); 2127 r = kvm_vm_ioctl_set_memory_region(kvm, &kvm_userspace_mem, 1);
2146 if (r)
2147 goto out;
2148 break; 2128 break;
2149 } 2129 }
2150 case KVM_GET_DIRTY_LOG: { 2130 case KVM_GET_DIRTY_LOG: {
@@ -2154,8 +2134,6 @@ static long kvm_vm_ioctl(struct file *filp,
2154 if (copy_from_user(&log, argp, sizeof log)) 2134 if (copy_from_user(&log, argp, sizeof log))
2155 goto out; 2135 goto out;
2156 r = kvm_vm_ioctl_get_dirty_log(kvm, &log); 2136 r = kvm_vm_ioctl_get_dirty_log(kvm, &log);
2157 if (r)
2158 goto out;
2159 break; 2137 break;
2160 } 2138 }
2161#ifdef KVM_COALESCED_MMIO_PAGE_OFFSET 2139#ifdef KVM_COALESCED_MMIO_PAGE_OFFSET
@@ -2165,9 +2143,6 @@ static long kvm_vm_ioctl(struct file *filp,
2165 if (copy_from_user(&zone, argp, sizeof zone)) 2143 if (copy_from_user(&zone, argp, sizeof zone))
2166 goto out; 2144 goto out;
2167 r = kvm_vm_ioctl_register_coalesced_mmio(kvm, &zone); 2145 r = kvm_vm_ioctl_register_coalesced_mmio(kvm, &zone);
2168 if (r)
2169 goto out;
2170 r = 0;
2171 break; 2146 break;
2172 } 2147 }
2173 case KVM_UNREGISTER_COALESCED_MMIO: { 2148 case KVM_UNREGISTER_COALESCED_MMIO: {
@@ -2176,9 +2151,6 @@ static long kvm_vm_ioctl(struct file *filp,
2176 if (copy_from_user(&zone, argp, sizeof zone)) 2151 if (copy_from_user(&zone, argp, sizeof zone))
2177 goto out; 2152 goto out;
2178 r = kvm_vm_ioctl_unregister_coalesced_mmio(kvm, &zone); 2153 r = kvm_vm_ioctl_unregister_coalesced_mmio(kvm, &zone);
2179 if (r)
2180 goto out;
2181 r = 0;
2182 break; 2154 break;
2183 } 2155 }
2184#endif 2156#endif
@@ -2287,8 +2259,6 @@ static long kvm_vm_compat_ioctl(struct file *filp,
2287 log.dirty_bitmap = compat_ptr(compat_log.dirty_bitmap); 2259 log.dirty_bitmap = compat_ptr(compat_log.dirty_bitmap);
2288 2260
2289 r = kvm_vm_ioctl_get_dirty_log(kvm, &log); 2261 r = kvm_vm_ioctl_get_dirty_log(kvm, &log);
2290 if (r)
2291 goto out;
2292 break; 2262 break;
2293 } 2263 }
2294 default: 2264 default: