kvm/x86: Fix unused variable warning in kvm_timer_init()
When CONFIG_CPU_FREQ is not set, int cpu is unused and gcc rightfully warns about it: arch/x86/kvm/x86.c: In function ‘kvm_timer_init’: arch/x86/kvm/x86.c:5697:6: warning: unused variable ‘cpu’ [-Wunused-variable] int cpu; ^~~ But since it is used only in the CONFIG_CPU_FREQ block, simply move it there, thus squashing the warning too. Signed-off-by: Borislav Petkov <bp@suse.de> Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
This commit is contained in:

committed by
Radim Krčmář

parent
1001354ca3
commit
758f588d6f
@@ -5733,13 +5733,13 @@ static int kvmclock_cpu_online(unsigned int cpu)
|
|||||||
|
|
||||||
static void kvm_timer_init(void)
|
static void kvm_timer_init(void)
|
||||||
{
|
{
|
||||||
int cpu;
|
|
||||||
|
|
||||||
max_tsc_khz = tsc_khz;
|
max_tsc_khz = tsc_khz;
|
||||||
|
|
||||||
if (!boot_cpu_has(X86_FEATURE_CONSTANT_TSC)) {
|
if (!boot_cpu_has(X86_FEATURE_CONSTANT_TSC)) {
|
||||||
#ifdef CONFIG_CPU_FREQ
|
#ifdef CONFIG_CPU_FREQ
|
||||||
struct cpufreq_policy policy;
|
struct cpufreq_policy policy;
|
||||||
|
int cpu;
|
||||||
|
|
||||||
memset(&policy, 0, sizeof(policy));
|
memset(&policy, 0, sizeof(policy));
|
||||||
cpu = get_cpu();
|
cpu = get_cpu();
|
||||||
cpufreq_get_policy(&policy, cpu);
|
cpufreq_get_policy(&policy, cpu);
|
||||||
|
Reference in New Issue
Block a user