History

KVM: x86: Mark expected switch fall-throughs

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. This patch fixes the following warnings: arch/x86/kvm/lapic.c:1037:27: warning: this statement may fall through [-Wimplicit-fallthrough=] arch/x86/kvm/lapic.c:1876:3: warning: this statement may fall through [-Wimplicit-fallthrough=] arch/x86/kvm/hyperv.c:1637:6: warning: this statement may fall through [-Wimplicit-fallthrough=] arch/x86/kvm/svm.c:4396:6: warning: this statement may fall through [-Wimplicit-fallthrough=] arch/x86/kvm/mmu.c:4372:36: warning: this statement may fall through [-Wimplicit-fallthrough=] arch/x86/kvm/x86.c:3835:6: warning: this statement may fall through [-Wimplicit-fallthrough=] arch/x86/kvm/x86.c:7938:23: warning: this statement may fall through [-Wimplicit-fallthrough=] arch/x86/kvm/vmx/vmx.c:2015:6: warning: this statement may fall through [-Wimplicit-fallthrough=] arch/x86/kvm/vmx/vmx.c:1773:6: warning: this statement may fall through [-Wimplicit-fallthrough=] Warning level 3 was used: -Wimplicit-fallthrough=3 This patch is part of the ongoing efforts to enabling -Wimplicit-fallthrough.

Gustavo A. R. Silva committed 7 years ago

Commit b2869f21 parent 5cd55486 files · +10 −4Browse files

Unified · Split

6 files
  1. arch/x86/kvm/hyperv.c +1 −1
  2. arch/x86/kvm/lapic.c +2 −0
  3. arch/x86/kvm/mmu.c +1 −0
  4. arch/x86/kvm/svm.c +1 −1
  5. arch/x86/kvm/vmx/vmx.c +2 −2
  6. arch/x86/kvm/x86.c +3 −0
arch/x86/kvm/hyperv.c+1−1
@@ -1636,7 +1636,7 @@ int kvm_hv_hypercall(struct kvm_vcpu *vcpu) · 1635 unmodified lines
16361636 ret = kvm_hvcall_signal_event(vcpu, fast, ingpa);
16371637 if (ret != HV_STATUS_INVALID_PORT_ID)
16381638 break;
1639− /* maybe userspace knows this conn_id: fall through */
1639+ /* fall through - maybe userspace knows this conn_id. */
16401640 case HVCALL_POST_MESSAGE:
16411641 /* don't bother userspace if it has no way to handle it */
16421642 if (unlikely(rep || !vcpu_to_synic(vcpu)->active)) {
arch/x86/kvm/lapic.c+2−0
@@ -1035,6 +1035,7 @@ static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode, · 1034 unmodified lines
10351035 switch (delivery_mode) {
10361036 case APIC_DM_LOWEST:
10371037 vcpu->arch.apic_arb_prio++;
1038+ /* fall through */
10381039 case APIC_DM_FIXED:
10391040 if (unlikely(trig_mode && !level))
10401041 break;
@@ -1874,6 +1875,7 @@ int kvm_lapic_reg_write(struct kvm_lapic *apic, u32 reg, u32 val) · 833 unmodified lines
18741875
18751876 case APIC_LVT0:
18761877 apic_manage_nmi_watchdog(apic, val);
1878+ /* fall through */
18771879 case APIC_LVTTHMR:
18781880 case APIC_LVTPC:
18791881 case APIC_LVT1:
arch/x86/kvm/mmu.c+1−0
@@ -4371,6 +4371,7 @@ __reset_rsvds_bits_mask(struct kvm_vcpu *vcpu, · 4370 unmodified lines
43714371 rsvd_bits(maxphyaddr, 51);
43724372 rsvd_check->rsvd_bits_mask[1][4] =
43734373 rsvd_check->rsvd_bits_mask[0][4];
4374+ /* fall through */
43744375 case PT64_ROOT_4LEVEL:
43754376 rsvd_check->rsvd_bits_mask[0][3] = exb_bit_rsvd |
43764377 nonleaf_bit8_rsvd | rsvd_bits(7, 7) |
arch/x86/kvm/svm.c+1−1
@@ -4403,7 +4403,7 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr) · 4402 unmodified lines
44034403 case MSR_IA32_APICBASE:
44044404 if (kvm_vcpu_apicv_active(vcpu))
44054405 avic_update_vapic_bar(to_svm(vcpu), data);
4406− /* Follow through */
4406+ /* Fall through */
44074407 default:
44084408 return kvm_set_msr_common(vcpu, msr);
44094409 }
arch/x86/kvm/vmx/vmx.c+2−2
@@ -1773,7 +1773,7 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) · 1772 unmodified lines
17731773 if (!msr_info->host_initiated &&
17741774 !guest_cpuid_has(vcpu, X86_FEATURE_RDTSCP))
17751775 return 1;
1776− /* Otherwise falls through */
1776+ /* Else, falls through */
17771777 default:
17781778 msr = find_msr_entry(vmx, msr_info->index);
17791779 if (msr) {
@@ -2014,7 +2014,7 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) · 234 unmodified lines
20142014 /* Check reserved bit, higher 32 bits should be zero */
20152015 if ((data >> 32) != 0)
20162016 return 1;
2017− /* Otherwise falls through */
2017+ /* Else, falls through */
20182018 default:
20192019 msr = find_msr_entry(vmx, msr_index);
20202020 if (msr) {
arch/x86/kvm/x86.c+3−0
@@ -3834,6 +3834,8 @@ static int kvm_vcpu_ioctl_enable_cap(struct kvm_vcpu *vcpu, · 3833 unmodified lines
38343834 case KVM_CAP_HYPERV_SYNIC2:
38353835 if (cap->args[0])
38363836 return -EINVAL;
3837+ /* fall through */
3838+
38373839 case KVM_CAP_HYPERV_SYNIC:
38383840 if (!irqchip_in_kernel(vcpu->kvm))
38393841 return -EINVAL;
@@ -7936,6 +7938,7 @@ static inline int vcpu_block(struct kvm *kvm, struct kvm_vcpu *vcpu) · 4096 unmodified lines
79367938 vcpu->arch.pv.pv_unhalted = false;
79377939 vcpu->arch.mp_state =
79387940 KVM_MP_STATE_RUNNABLE;
7941+ /* fall through */
79397942 case KVM_MP_STATE_RUNNABLE:
79407943 vcpu->arch.apf.halted = false;
79417944 break;