* [RESEND PATCH] iommu/intel: fix variable 'iommu' set but not used
@ 2019-05-22 20:36 Qian Cai
2019-05-22 21:14 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: Qian Cai @ 2019-05-22 20:36 UTC (permalink / raw)
To: akpm; +Cc: Qian Cai, iommu, jroedel, dwmw2, linux-kernel
The 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 passing "drhd->iommu" directly to
for_each_active_iommu() which all subsequent self-assignments should be
ignored by a compiler anyway.
Signed-off-by: Qian Cai <cai@lca.pw>
---
drivers/iommu/intel-iommu.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index a209199f3af6..86e1ddcb4a8e 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -3034,7 +3034,6 @@ static int __init iommu_prepare_static_identity_mapping(int hw)
{
struct pci_dev *pdev = NULL;
struct dmar_drhd_unit *drhd;
- struct intel_iommu *iommu;
struct device *dev;
int i;
int ret = 0;
@@ -3045,7 +3044,7 @@ static int __init iommu_prepare_static_identity_mapping(int hw)
return ret;
}
- for_each_active_iommu(iommu, drhd)
+ for_each_active_iommu(drhd->iommu, drhd)
for_each_active_dev_scope(drhd->devices, drhd->devices_cnt, i, dev) {
struct acpi_device_physical_node *pn;
struct acpi_device *adev;
--
1.8.3.1
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [RESEND PATCH] iommu/intel: fix variable 'iommu' set but not used
2019-05-22 20:36 [RESEND PATCH] iommu/intel: fix variable 'iommu' set but not used Qian Cai
@ 2019-05-22 21:14 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2019-05-22 21:14 UTC (permalink / raw)
To: Qian Cai; +Cc: iommu, jroedel, dwmw2, linux-kernel
On Wed, 22 May 2019 16:36:26 -0400 Qian Cai <cai@lca.pw> wrote:
> The 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 passing "drhd->iommu" directly to
> for_each_active_iommu() which all subsequent self-assignments should be
> ignored by a compiler anyway.
>
Yes, assigning drhd->iommu to itself seems a bit nasty. Maybe this is
a case for __mabe_unused (with a comment explaining why), if that fixes
the warning. Dunno.
btw, for_each_active_dev_scope() and for_each_dev_scope() should be
dragged out and shot. Or at least, should have those single-char
identifiers changed into something meaningful so poor sods like me have
a hope of understanding the code :(
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-05-22 21:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-22 20:36 [RESEND PATCH] iommu/intel: fix variable 'iommu' set but not used Qian Cai
2019-05-22 21:14 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).