OSDN Git Service

drivers/iommu/intel-iommu.c: fix variable 'iommu' set but not used
authorQian Cai <cai@lca.pw>
Sat, 1 Jun 2019 05:30:49 +0000 (22:30 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 1 Jun 2019 22:51:32 +0000 (15:51 -0700)
Commit cf04eee8bf0e ("iommu/vt-d: Include ACPI devices in iommu=pt")
added for_each_active_iommu() in iommu_prepare_static_identity_mapping()
but never used the each element, i.e, "drhd->iommu".

drivers/iommu/intel-iommu.c: In function
'iommu_prepare_static_identity_mapping':
drivers/iommu/intel-iommu.c:3037:22: warning: variable 'iommu' set but
not used [-Wunused-but-set-variable]
 struct intel_iommu *iommu;

Fixed the warning by appending a compiler attribute __maybe_unused for it.

Link: http://lkml.kernel.org/r/20190523013314.2732-1-cai@lca.pw
Signed-off-by: Qian Cai <cai@lca.pw>
Suggested-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Joerg Roedel <jroedel@suse.de>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/iommu/intel-iommu.c

index a209199..09b8ff0 100644 (file)
@@ -3034,7 +3034,8 @@ static int __init iommu_prepare_static_identity_mapping(int hw)
 {
        struct pci_dev *pdev = NULL;
        struct dmar_drhd_unit *drhd;
-       struct intel_iommu *iommu;
+       /* To avoid a -Wunused-but-set-variable warning. */
+       struct intel_iommu *iommu __maybe_unused;
        struct device *dev;
        int i;
        int ret = 0;