[PATCH 3/3] KVM: SVM: Use compound literal in lieu of __maybe_unused rdmsr() param

From: Sean Christopherson
Date: Mon Jun 17 2024 - 17:05:52 EST


When reading MSR_TSC_AUX, which is effectively a 32-bit value, use a
compound literal to consume/ignore the upper 32 bits instead of a "maybe"
unused local variable. While (ab)using a compound literal to discard an
unused output is unusual, it's perfectly legal as compound literals are
valid, modifiable l-values in C99 and beyond.

No functional change intended.

Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
---
arch/x86/kvm/svm/svm.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
index cf285472fea6..69c0dea5cc0d 100644
--- a/arch/x86/kvm/svm/svm.c
+++ b/arch/x86/kvm/svm/svm.c
@@ -678,11 +678,8 @@ static int svm_hardware_enable(void)
* Since Linux does not change the value of TSC_AUX once set, prime the
* TSC_AUX field now to avoid a RDMSR on every vCPU run.
*/
- if (boot_cpu_has(X86_FEATURE_V_TSC_AUX)) {
- u32 __maybe_unused msr_hi;
-
- rdmsr(MSR_TSC_AUX, sev_es_host_save_area(sd)->tsc_aux, msr_hi);
- }
+ if (boot_cpu_has(X86_FEATURE_V_TSC_AUX))
+ rdmsr(MSR_TSC_AUX, sev_es_host_save_area(sd)->tsc_aux, (u32){0});

return 0;
}
--
2.45.2.627.g7a2c4fd464-goog