All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] selftests: kvm/x86: Fix the warning in pmu_event_filter_test.c
@ 2022-01-19 13:39 Jinrong Liang
  2022-01-19 18:37 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Jinrong Liang @ 2022-01-19 13:39 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Wanpeng Li, Sean Christopherson, Jim Mattson, Vitaly Kuznetsov,
	Joerg Roedel, Jinrong Liang, kvm, linux-kernel

From: Jinrong Liang <cloudliang@tencent.com>

The following warning appears when executing
make -C tools/testing/selftests/kvm

x86_64/pmu_event_filter_test.c: In function ‘vcpu_supports_intel_br_retired’:
x86_64/pmu_event_filter_test.c:241:28: warning: variable ‘cpuid’ set but not used [-Wunused-but-set-variable]
  241 |         struct kvm_cpuid2 *cpuid;
      |                            ^~~~~
x86_64/pmu_event_filter_test.c: In function ‘vcpu_supports_amd_zen_br_retired’:
x86_64/pmu_event_filter_test.c:258:28: warning: variable ‘cpuid’ set but not used [-Wunused-but-set-variable]
  258 |         struct kvm_cpuid2 *cpuid;
      |                            ^~~~~

Just delete the unused variables to stay away from warnings.

Fixes: dc7e75b3b3ee ("selftests: kvm/x86: Add test for KVM_SET_PMU_EVENT_FILTER")
Signed-off-by: Jinrong Liang <cloudliang@tencent.com>
---
 tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c b/tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c
index 8ac99d4cbc73..0611a5c24bbc 100644
--- a/tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c
+++ b/tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c
@@ -238,9 +238,7 @@ static void test_not_member_allow_list(struct kvm_vm *vm)
 static bool vcpu_supports_intel_br_retired(void)
 {
 	struct kvm_cpuid_entry2 *entry;
-	struct kvm_cpuid2 *cpuid;
 
-	cpuid = kvm_get_supported_cpuid();
 	entry = kvm_get_supported_cpuid_index(0xa, 0);
 	return entry &&
 		(entry->eax & 0xff) &&
@@ -255,9 +253,7 @@ static bool vcpu_supports_intel_br_retired(void)
 static bool vcpu_supports_amd_zen_br_retired(void)
 {
 	struct kvm_cpuid_entry2 *entry;
-	struct kvm_cpuid2 *cpuid;
 
-	cpuid = kvm_get_supported_cpuid();
 	entry = kvm_get_supported_cpuid_index(1, 0);
 	return entry &&
 		((x86_family(entry->eax) == 0x17 &&
-- 
2.33.1


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

* Re: [PATCH] selftests: kvm/x86: Fix the warning in pmu_event_filter_test.c
  2022-01-19 13:39 [PATCH] selftests: kvm/x86: Fix the warning in pmu_event_filter_test.c Jinrong Liang
@ 2022-01-19 18:37 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2022-01-19 18:37 UTC (permalink / raw)
  To: Jinrong Liang
  Cc: Wanpeng Li, Sean Christopherson, Jim Mattson, Vitaly Kuznetsov,
	Joerg Roedel, Jinrong Liang, kvm, linux-kernel

On 1/19/22 14:39, Jinrong Liang wrote:
> From: Jinrong Liang <cloudliang@tencent.com>
> 
> The following warning appears when executing
> make -C tools/testing/selftests/kvm
> 
> x86_64/pmu_event_filter_test.c: In function ‘vcpu_supports_intel_br_retired’:
> x86_64/pmu_event_filter_test.c:241:28: warning: variable ‘cpuid’ set but not used [-Wunused-but-set-variable]
>    241 |         struct kvm_cpuid2 *cpuid;
>        |                            ^~~~~
> x86_64/pmu_event_filter_test.c: In function ‘vcpu_supports_amd_zen_br_retired’:
> x86_64/pmu_event_filter_test.c:258:28: warning: variable ‘cpuid’ set but not used [-Wunused-but-set-variable]
>    258 |         struct kvm_cpuid2 *cpuid;
>        |                            ^~~~~
> 
> Just delete the unused variables to stay away from warnings.
> 
> Fixes: dc7e75b3b3ee ("selftests: kvm/x86: Add test for KVM_SET_PMU_EVENT_FILTER")
> Signed-off-by: Jinrong Liang <cloudliang@tencent.com>
> ---
>   tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c | 4 ----
>   1 file changed, 4 deletions(-)
> 
> diff --git a/tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c b/tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c
> index 8ac99d4cbc73..0611a5c24bbc 100644
> --- a/tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c
> +++ b/tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c
> @@ -238,9 +238,7 @@ static void test_not_member_allow_list(struct kvm_vm *vm)
>   static bool vcpu_supports_intel_br_retired(void)
>   {
>   	struct kvm_cpuid_entry2 *entry;
> -	struct kvm_cpuid2 *cpuid;
>   
> -	cpuid = kvm_get_supported_cpuid();
>   	entry = kvm_get_supported_cpuid_index(0xa, 0);
>   	return entry &&
>   		(entry->eax & 0xff) &&
> @@ -255,9 +253,7 @@ static bool vcpu_supports_intel_br_retired(void)
>   static bool vcpu_supports_amd_zen_br_retired(void)
>   {
>   	struct kvm_cpuid_entry2 *entry;
> -	struct kvm_cpuid2 *cpuid;
>   
> -	cpuid = kvm_get_supported_cpuid();
>   	entry = kvm_get_supported_cpuid_index(1, 0);
>   	return entry &&
>   		((x86_family(entry->eax) == 0x17 &&

Queued, thanks.

Paolo


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

end of thread, other threads:[~2022-01-19 18:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-19 13:39 [PATCH] selftests: kvm/x86: Fix the warning in pmu_event_filter_test.c Jinrong Liang
2022-01-19 18:37 ` Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.