DMAR: clean up warnings about write-only variables

For some of them, used only when KTR or KMSAN are configured, apply
__unused attribute directly.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2021-10-21 20:23:45 +03:00
parent bded8fa300
commit 661bd70bd7
5 changed files with 8 additions and 10 deletions

View File

@ -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;
@ -920,7 +921,7 @@ static void
iommu_bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map1,
bus_dmasync_op_t op)
{
struct bus_dmamap_iommu *map;
struct bus_dmamap_iommu *map __unused;
map = (struct bus_dmamap_iommu *)map1;
kmsan_bus_dmamap_sync(&map->kmsan_mem, op);

View File

@ -354,7 +354,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
@ -475,7 +475,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);

View File

@ -521,7 +521,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;
@ -904,7 +904,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);

View File

@ -762,7 +762,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;
@ -774,7 +773,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];

View File

@ -425,7 +425,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;
@ -433,7 +433,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;