KVM: nVMX: allow compiling with W=1
PATCH 1/1 KVM: nVMX: allow compiling with W=1
Compile error with CONFIG_KVM_INTEL=y and W=1:
CC arch/x86/kvm/vmx/vmx.oarch/x86/kvm/vmx/vmx.c:68:32: error: 'vmx_cpu_id' defined but not used [-Werror=unused-const-variable=]
68 | static const struct x86_cpu_id vmx_cpu_id[] = {
| ^~~~~~~~~~cc1: all warnings being treated as errors
When building with =y, the MODULE_DEVICE_TABLE macro doesn't generate a reference to the structure (or any code at all). This makes W=1 compiles unhappy.
Wrap both in a #ifdef to avoid the issue.
arch/x86/kvm/vmx/vmx.c +2 -0
@@ -65,11 +65,13 @@MODULE_AUTHOR ("Qumranet" );MODULE_LICENSE ("GPL" ); +#ifdef MODULE static const struct x86_cpu_id vmx_cpu_id[] = {X86_FEATURE_MATCH (X86_FEATURE_VMX ), {} };MODULE_DEVICE_TABLE (x86cpu, vmx_cpu_id); +#endif bool __read_mostly enable_vpid =1 ;module_param_named (vpid, enable_vpid, bool,0444 );
Paolo Bonzini
maintainerQuoted 25 lines · Valdis Klētnieks
Compile error with
CONFIG_KVM_INTEL=yand W=1:CC
arch/x86/kvm/vmx/vmx.oarch/x86/kvm/vmx/vmx.c:68:32: error: 'vmx_cpu_id' defined but not used [-Werror=unused-const-variable=]68 | static const struct x86_cpu_id vmx_cpu_id[] = { | ^~~~~~~~~~cc1: all warnings being treated as errors
When building with =y, the
MODULE_DEVICE_TABLEmacro doesn't generate a reference to the structure (or any code at all). This makes W=1 compiles unhappy.Wrap both in a #ifdef to avoid the issue.
Signed-off-by Valdis Kletnieks <[email protected]>arch/x86/kvm/vmx/vmx.c +0
-0@@ -65,11 +65,13 @@MODULE_AUTHOR ("Qumranet" );MODULE_LICENSE ("GPL" );
arch/x86/kvm/vmx/vmx.c line 77
Quoted 10 lines
arch/x86/kvm/vmx/vmx.c +2
-0+#ifdef MODULE static const struct x86_cpu_id vmx_cpu_id[] = {X86_FEATURE_MATCH (X86_FEATURE_VMX ), {} };MODULE_DEVICE_TABLE (x86cpu, vmx_cpu_id); +#endif bool __read_mostly enable_vpid =1 ;module_param_named (vpid, enable_vpid, bool,0444 );
Queued, and doing the same for AMD.
Paolo