git: cf049c292eb4 - stable/13 - DMAR: clean up warnings about write-only variables

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Wed, 27 Oct 2021 00:45:19 UTC
The branch stable/13 has been updated by kib:

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

commit cf049c292eb42095189663565bf68bd8118f0130
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2021-10-21 17:23:45 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2021-10-27 00:24:40 +0000

    DMAR: clean up warnings about write-only variables
    
    (cherry picked from commit 661bd70bd72d510ad7153df530d55a300046d619)
---
 sys/dev/iommu/busdma_iommu.c  | 3 ++-
 sys/dev/iommu/iommu_gas.c     | 4 ++--
 sys/x86/iommu/intel_ctx.c     | 4 ++--
 sys/x86/iommu/intel_drv.c     | 2 --
 sys/x86/iommu/intel_idpgtbl.c | 3 +--
 5 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/sys/dev/iommu/busdma_iommu.c b/sys/dev/iommu/busdma_iommu.c
index 9cafd49807ff..41d370a608bc 100644
--- a/sys/dev/iommu/busdma_iommu.c
+++ b/sys/dev/iommu/busdma_iommu.c
@@ -398,7 +398,8 @@ iommu_bus_dma_tag_set_domain(bus_dma_tag_t dmat)
 static int
 iommu_bus_dma_tag_destroy(bus_dma_tag_t dmat1)
 {
-	struct bus_dma_tag_iommu *dmat, *dmat_copy, *parent;
+	struct bus_dma_tag_iommu *dmat, *parent;
+	struct bus_dma_tag_iommu *dmat_copy __unused;
 	int error;
 
 	error = 0;
diff --git a/sys/dev/iommu/iommu_gas.c b/sys/dev/iommu/iommu_gas.c
index 431c0c195c35..ba79ea5ce44e 100644
--- a/sys/dev/iommu/iommu_gas.c
+++ b/sys/dev/iommu/iommu_gas.c
@@ -355,7 +355,7 @@ iommu_gas_match_one(struct iommu_gas_match_args *a, iommu_gaddr_t beg,
 static void
 iommu_gas_match_insert(struct iommu_gas_match_args *a)
 {
-	bool found;
+	bool found __diagused;
 
 	/*
 	 * The prev->end is always aligned on the page size, which
@@ -476,7 +476,7 @@ iommu_gas_alloc_region(struct iommu_domain *domain, struct iommu_map_entry *entr
     u_int flags)
 {
 	struct iommu_map_entry *next, *prev;
-	bool found;
+	bool found __diagused;
 
 	IOMMU_DOMAIN_ASSERT_LOCKED(domain);
 
diff --git a/sys/x86/iommu/intel_ctx.c b/sys/x86/iommu/intel_ctx.c
index 110740d6ad01..78d6ef8cc254 100644
--- a/sys/x86/iommu/intel_ctx.c
+++ b/sys/x86/iommu/intel_ctx.c
@@ -522,7 +522,7 @@ dmar_get_ctx_for_dev1(struct dmar_unit *dmar, device_t dev, uint16_t rid,
 {
 	struct dmar_domain *domain, *domain1;
 	struct dmar_ctx *ctx, *ctx1;
-	struct iommu_unit *unit;
+	struct iommu_unit *unit __diagused;
 	dmar_ctx_entry_t *ctxp;
 	struct sf_buf *sf;
 	int bus, slot, func, error;
@@ -905,7 +905,7 @@ dmar_domain_unload(struct dmar_domain *domain,
 	struct dmar_unit *unit;
 	struct iommu_domain *iodom;
 	struct iommu_map_entry *entry, *entry1;
-	int error;
+	int error __diagused;
 
 	iodom = DOM2IODOM(domain);
 	unit = DOM2DMAR(domain);
diff --git a/sys/x86/iommu/intel_drv.c b/sys/x86/iommu/intel_drv.c
index 38442795c5e4..96ed1d04a794 100644
--- a/sys/x86/iommu/intel_drv.c
+++ b/sys/x86/iommu/intel_drv.c
@@ -763,7 +763,6 @@ dmar_find_by_scope(int dev_domain, int dev_busno,
 struct dmar_unit *
 dmar_find(device_t dev, bool verbose)
 {
-	device_t dmar_dev;
 	struct dmar_unit *unit;
 	const char *banner;
 	int i, dev_domain, dev_busno, dev_path_len;
@@ -775,7 +774,6 @@ dmar_find(device_t dev, bool verbose)
 	    devclass_find("pci"))
 		return (NULL);
 
-	dmar_dev = NULL;
 	dev_domain = pci_get_domain(dev);
 	dev_path_len = dmar_dev_depth(dev);
 	ACPI_DMAR_PCI_PATH dev_path[dev_path_len];
diff --git a/sys/x86/iommu/intel_idpgtbl.c b/sys/x86/iommu/intel_idpgtbl.c
index 9fd06d49d3b0..e031799d2a01 100644
--- a/sys/x86/iommu/intel_idpgtbl.c
+++ b/sys/x86/iommu/intel_idpgtbl.c
@@ -426,7 +426,7 @@ domain_map_buf_locked(struct dmar_domain *domain, iommu_gaddr_t base,
 {
 	dmar_pte_t *pte;
 	struct sf_buf *sf;
-	iommu_gaddr_t pg_sz, base1, size1;
+	iommu_gaddr_t pg_sz, base1;
 	vm_pindex_t pi, c, idx, run_sz;
 	int lvl;
 	bool superpage;
@@ -434,7 +434,6 @@ domain_map_buf_locked(struct dmar_domain *domain, iommu_gaddr_t base,
 	DMAR_DOMAIN_ASSERT_PGLOCKED(domain);
 
 	base1 = base;
-	size1 = size;
 	flags |= IOMMU_PGF_OBJL;
 	TD_PREP_PINNED_ASSERT;