kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kvm/x86: Fix unused variable warning in kvm_timer_init()
@ 2016-09-04 17:13 Borislav Petkov
  2016-09-29 18:26 ` Radim Krčmář
  0 siblings, 1 reply; 2+ messages in thread
From: Borislav Petkov @ 2016-09-04 17:13 UTC (permalink / raw)
  To: KVM; +Cc: LKML

From: Borislav Petkov <bp@suse.de>

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>
---
 arch/x86/kvm/x86.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 19f9f9e05c2a..30bff0c1357a 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -5694,13 +5694,13 @@ static int kvmclock_cpu_online(unsigned int cpu)
 
 static void kvm_timer_init(void)
 {
-	int cpu;
-
 	max_tsc_khz = tsc_khz;
 
 	if (!boot_cpu_has(X86_FEATURE_CONSTANT_TSC)) {
 #ifdef CONFIG_CPU_FREQ
 		struct cpufreq_policy policy;
+		int cpu;
+
 		memset(&policy, 0, sizeof(policy));
 		cpu = get_cpu();
 		cpufreq_get_policy(&policy, cpu);
-- 
2.10.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] kvm/x86: Fix unused variable warning in kvm_timer_init()
  2016-09-04 17:13 [PATCH] kvm/x86: Fix unused variable warning in kvm_timer_init() Borislav Petkov
@ 2016-09-29 18:26 ` Radim Krčmář
  0 siblings, 0 replies; 2+ messages in thread
From: Radim Krčmář @ 2016-09-29 18:26 UTC (permalink / raw)
  To: Borislav Petkov; +Cc: KVM, LKML

2016-09-04 19:13+0200, Borislav Petkov:
> From: Borislav Petkov <bp@suse.de>
> 
> 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>
> ---

Applied to kvm/queue, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-09-29 18:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-04 17:13 [PATCH] kvm/x86: Fix unused variable warning in kvm_timer_init() Borislav Petkov
2016-09-29 18:26 ` Radim Krčmář

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).