Skip to content

Commit 7d4bd1d

Browse files
wildea01chazy
authored andcommitted
arm64: KVM: Add braces to multi-line if statement in virtual PMU code
The kernel is written in C, not python, so we need braces around multi-line if statements. GCC 6 actually warns about this, thanks to the fantastic new "-Wmisleading-indentation" flag: | virt/kvm/arm/pmu.c: In function ‘kvm_pmu_overflow_status’: | virt/kvm/arm/pmu.c:198:3: warning: statement is indented as if it were guarded by... [-Wmisleading-indentation] | reg &= vcpu_sys_reg(vcpu, PMCNTENSET_EL0); | ^~~ | arch/arm64/kvm/../../../virt/kvm/arm/pmu.c:196:2: note: ...this ‘if’ clause, but it is not | if ((vcpu_sys_reg(vcpu, PMCR_EL0) & ARMV8_PMU_PMCR_E)) | ^~ As it turns out, this particular case is harmless (we just do some &= operations with 0), but worth fixing nonetheless. Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
1 parent 5f5560b commit 7d4bd1d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

virt/kvm/arm/pmu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,12 @@ static u64 kvm_pmu_overflow_status(struct kvm_vcpu *vcpu)
193193
{
194194
u64 reg = 0;
195195

196-
if ((vcpu_sys_reg(vcpu, PMCR_EL0) & ARMV8_PMU_PMCR_E))
196+
if ((vcpu_sys_reg(vcpu, PMCR_EL0) & ARMV8_PMU_PMCR_E)) {
197197
reg = vcpu_sys_reg(vcpu, PMOVSSET_EL0);
198198
reg &= vcpu_sys_reg(vcpu, PMCNTENSET_EL0);
199199
reg &= vcpu_sys_reg(vcpu, PMINTENSET_EL1);
200200
reg &= kvm_pmu_valid_counter_mask(vcpu);
201+
}
201202

202203
return reg;
203204
}

0 commit comments

Comments
 (0)