x86/kvm: remove a redundant variable
PATCH 1/4 x86/kvm: remove a redundant variable
variable 'cpu' is defined repeatedly.
Signed-off-by Peng Hao <[email protected]>
--- arch/x86/kvm/vmx/vmx.c | 1 - 1 file changed, 1 deletion(-)
arch/x86/kvm/vmx/vmx.c +0 -1
@@ -7931,7 +7931,6 @@ static int __init vmx_init(void) ms_hyperv.hints & HV_X64_ENLIGHTENED_VMCS_RECOMMENDED && (ms_hyperv.nested_features & HV_X64_ENLIGHTENED_VMCS_VERSION) >= KVM_EVMCS_VERSION) { -int cpu;/* Check that we have assist pages on all online CPUs */ for_each_online_cpu (cpu) {
Signature · 1 line
2.27.0
Similar comments to the other patch. "KVM: VMX:" for the scope, and a more descriptive shortlog.
Also, this patch isn't part of a series, it should be simply "PATCH", not "patch 1/4".
Quoted 1 line · Peng Hao
variable 'cpu' is defined repeatedly.
The changelog should make it clear why it's ok to remove the redundant variable. E.g.
KVM: VMX: Remove scratch 'cpu' variable that shadows an identical scratch var
Remove a redundant 'cpu' declaration from inside an if-statement that that shadows an identical declaration at function scope. Both variables are used as scratch variables in for_each_*_cpu() loops, thus there's no harm in sharing a variable.
With that,
Reviewed-by Sean Christopherson <[email protected]>
Quoted 20 lines
Signed-off-by Peng Hao <[email protected]>--- arch/x86/kvm/vmx/vmx.c | 1 - 1 file changed, 1 deletion(-)arch/x86/kvm/vmx/vmx.c +0
-1@@ -7931,7 +7931,6 @@ static int __init vmx_init(void) ms_hyperv.hints & HV_X64_ENLIGHTENED_VMCS_RECOMMENDED && (ms_hyperv.nested_features & HV_X64_ENLIGHTENED_VMCS_VERSION) >= KVM_EVMCS_VERSION) { -int cpu;/* Check that we have assist pages on all online CPUs */ for_each_online_cpu (cpu) {Signature · 1 line
2.27.0