Skip to contentSkip to conversation

selftests: kvm/x86: Fix the warning in pmu_event_filter_test.c

PATCH Applied Jinrong Liang 2 participants 2 messages Jan 19, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests: kvm/x86: Fix the warning in pmu_event_filter_test.c

From: Jinrong Liang <[email protected]>

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")
---
 tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c | 4 ----
 1 file changed, 4 deletions(-)
tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c +0 -4
index 8ac99d4cbc73..0611a5c24bbc 100644
@@ -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 &&
Signature · 1 line
2.33.1
maintainer Applied
#1 lore raw
Quoted 37 lines · Jinrong Liang

From: Jinrong Liang <[email protected]>

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")
---
  tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c | 4 ----
  1 file changed, 4 deletions(-)
tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c +0 -2
index 8ac99d4cbc73..0611a5c24bbc 100644
@@ -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) &&

tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c static bool vcpu_supports_intel_br_retired(void) · line 259

Quoted 9 lines
tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c +0 -2
@@ -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