git: 27007f7863f1 - stable/13 - vmm: fix set but not used warnings

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Thu, 26 Jan 2023 19:28:42 UTC
The branch stable/13 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=27007f7863f19e4b10b514090b28819d62228a62

commit 27007f7863f19e4b10b514090b28819d62228a62
Author:     Robert Wing <rew@FreeBSD.org>
AuthorDate: 2022-04-10 18:30:08 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2023-01-26 19:26:46 +0000

    vmm: fix set but not used warnings
    
    (cherry picked from commit f877977a034b41bedacdf507e79e4233b28a8bfc)
---
 sys/amd64/vmm/amd/svm.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/sys/amd64/vmm/amd/svm.c b/sys/amd64/vmm/amd/svm.c
index f50a4c8c9097..8fbe0817fc8e 100644
--- a/sys/amd64/vmm/amd/svm.c
+++ b/sys/amd64/vmm/amd/svm.c
@@ -351,7 +351,7 @@ svm_msr_index(uint64_t msr, int *index, int *bit)
 static void
 svm_msr_perm(uint8_t *perm_bitmap, uint64_t msr, bool read, bool write)
 {
-	int index, bit, error;
+	int index, bit, error __diagused;
 
 	error = svm_msr_index(msr, &index, &bit);
 	KASSERT(error == 0, ("%s: invalid msr %#lx", __func__, msr));
@@ -658,7 +658,7 @@ svm_vcpu_mode(struct vmcb *vmcb)
 {
 	struct vmcb_segment seg;
 	struct vmcb_state *state;
-	int error;
+	int error __diagused;
 
 	state = &vmcb->state;
 
@@ -723,7 +723,7 @@ static void
 svm_inout_str_seginfo(struct svm_softc *svm_sc, int vcpu, int64_t info1,
     int in, struct vm_inout_str *vis)
 {
-	int error, s;
+	int error __diagused, s;
 
 	if (in) {
 		vis->seg_name = VM_REG_GUEST_ES;
@@ -862,7 +862,7 @@ svm_handle_inst_emul(struct vmcb *vmcb, uint64_t gpa, struct vm_exit *vmexit)
 	struct vmcb_segment seg;
 	struct vmcb_ctrl *ctrl;
 	char *inst_bytes;
-	int error, inst_len;
+	int error __diagused, inst_len;
 
 	ctrl = &vmcb->ctrl;
 	paging = &vmexit->u.inst_emul.paging;
@@ -1117,7 +1117,7 @@ enable_nmi_blocking(struct svm_softc *sc, int vcpu)
 static void
 clear_nmi_blocking(struct svm_softc *sc, int vcpu)
 {
-	int error;
+	int error __diagused;
 
 	KASSERT(nmi_blocked(sc, vcpu), ("vNMI already unblocked"));
 	VCPU_CTR0(sc->vm, vcpu, "vNMI blocking cleared");
@@ -1150,7 +1150,7 @@ svm_write_efer(struct svm_softc *sc, int vcpu, uint64_t newval, bool *retu)
 	struct vm_exit *vme;
 	struct vmcb_state *state;
 	uint64_t changed, lma, oldval;
-	int error;
+	int error __diagused;
 
 	state = svm_get_vmcb_state(sc, vcpu);
 
@@ -1332,7 +1332,7 @@ svm_vmexit(struct svm_softc *svm_sc, int vcpu, struct vm_exit *vmexit)
 	struct svm_regctx *ctx;
 	uint64_t code, info1, info2, val;
 	uint32_t eax, ecx, edx;
-	int error, errcode_valid, handled, idtvec, reflect;
+	int error __diagused, errcode_valid, handled, idtvec, reflect;
 	bool retu;
 
 	ctx = svm_get_guest_regctx(svm_sc, vcpu);
@@ -2572,7 +2572,6 @@ done:
 static int
 svm_vmcx_snapshot(void *arg, struct vm_snapshot_meta *meta, int vcpu)
 {
-	struct vmcb *vmcb;
 	struct svm_softc *sc;
 	int err, running, hostcpu;
 
@@ -2580,7 +2579,6 @@ svm_vmcx_snapshot(void *arg, struct vm_snapshot_meta *meta, int vcpu)
 	err = 0;
 
 	KASSERT(arg != NULL, ("%s: arg was NULL", __func__));
-	vmcb = svm_get_vmcb(sc, vcpu);
 
 	running = vcpu_is_running(sc->vm, vcpu, &hostcpu);
 	if (running && hostcpu !=curcpu) {