[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200801112446.149549-16-refactormyself@gmail.com>
Date: Sat, 1 Aug 2020 13:24:44 +0200
From: "Saheed O. Bolarinwa" <refactormyself@...il.com>
To: helgaas@...nel.org, Joerg Roedel <joro@...tes.org>
Cc: "Saheed O. Bolarinwa" <refactormyself@...il.com>,
bjorn@...gaas.com, skhan@...uxfoundation.org,
linux-kernel-mentees@...ts.linuxfoundation.org,
linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
David Woodhouse <dwmw2@...radead.org>,
Lu Baolu <baolu.lu@...ux.intel.com>,
iommu@...ts.linux-foundation.org
Subject: [RFC PATCH 15/17] iommu/vt-d: Drop uses of pci_read_config_*() return value
The return value of pci_read_config_*() may not indicate a device error.
However, the value read by these functions is more likely to indicate
this kind of error. This presents two overlapping ways of reporting
errors and complicates error checking.
It is possible to move to one single way of checking for error if the
dependency on the return value of these functions is removed, then it
can later be made to return void.
Remove all uses of the return value of pci_read_config_*().
Check the actual value read for ~0. In this case, ~0 is an invalid
value thus it indicates some kind of error.
Suggested-by: Bjorn Helgaas <bjorn@...gaas.com>
Signed-off-by: Saheed O. Bolarinwa <refactormyself@...il.com>
---
drivers/iommu/intel/iommu.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index d759e7234e98..aad3c065e4a0 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -6165,7 +6165,8 @@ static void quirk_calpella_no_shadow_gtt(struct pci_dev *dev)
if (risky_device(dev))
return;
- if (pci_read_config_word(dev, GGC, &ggc))
+ pci_read_config_word(dev, GGC, &ggc);
+ if (ggc == (u16)~0)
return;
if (!(ggc & GGC_MEMORY_VT_ENABLED)) {
@@ -6218,7 +6219,8 @@ static void __init check_tylersburg_isoch(void)
return;
}
- if (pci_read_config_dword(pdev, 0x188, &vtisochctrl)) {
+ pci_read_config_dword(pdev, 0x188, &vtisochctrl);
+ if (vtisochctrl == (uint32_t)~0) {
pci_dev_put(pdev);
return;
}
--
2.18.4
Powered by blists - more mailing lists