[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] IOMMU/x86: drop pointless NULL checks



commit 893335807d5b11d0899e7b7bb3cb45c5af289767
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu Sep 16 10:58:03 2021 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Sep 16 10:58:03 2021 +0200

    IOMMU/x86: drop pointless NULL checks
    
    map_domain_page() et al never fail; no need to check their return values
    against NULL, and no need to carry dead printk()s.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>
---
 xen/drivers/passthrough/amd/pci_amd_iommu.c |  6 ------
 xen/drivers/passthrough/vtd/iommu.c         |  6 ------
 xen/drivers/passthrough/vtd/utils.c         | 15 ---------------
 3 files changed, 27 deletions(-)

diff --git a/xen/drivers/passthrough/amd/pci_amd_iommu.c 
b/xen/drivers/passthrough/amd/pci_amd_iommu.c
index 342fce6fff..819b5a6cc3 100644
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c
@@ -566,12 +566,6 @@ static void amd_dump_page_table_level(struct page_info 
*pg, int level,
         return;
 
     table_vaddr = __map_domain_page(pg);
-    if ( table_vaddr == NULL )
-    {
-        printk("AMD IOMMU failed to map domain page %"PRIpaddr"\n",
-                page_to_maddr(pg));
-        return;
-    }
 
     for ( index = 0; index < PTE_PER_TABLE_SIZE; index++ )
     {
diff --git a/xen/drivers/passthrough/vtd/iommu.c 
b/xen/drivers/passthrough/vtd/iommu.c
index fc55f16343..bab19d79e8 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -2633,12 +2633,6 @@ static void vtd_dump_page_table_level(paddr_t pt_maddr, 
int level, paddr_t gpa,
         return;
 
     pt_vaddr = map_vtd_domain_page(pt_maddr);
-    if ( pt_vaddr == NULL )
-    {
-        printk(VTDPREFIX " failed to map domain page %"PRIpaddr"\n",
-               pt_maddr);
-        return;
-    }
 
     next_level = level - 1;
     for ( i = 0; i < PTE_NUM; i++ )
diff --git a/xen/drivers/passthrough/vtd/utils.c 
b/xen/drivers/passthrough/vtd/utils.c
index 788cbdeee4..56dfdff9bd 100644
--- a/xen/drivers/passthrough/vtd/utils.c
+++ b/xen/drivers/passthrough/vtd/utils.c
@@ -106,11 +106,6 @@ void print_vtd_entries(struct vtd_iommu *iommu, int bus, 
int devfn, u64 gmfn)
     }
 
     root_entry = (struct root_entry *)map_vtd_domain_page(iommu->root_maddr);
-    if ( root_entry == NULL )
-    {
-        printk("    root_entry == NULL\n");
-        return;
-    }
 
     printk("    root_entry[%02x] = %"PRIx64"\n", bus, root_entry[bus].val);
     if ( !root_present(root_entry[bus]) )
@@ -123,11 +118,6 @@ void print_vtd_entries(struct vtd_iommu *iommu, int bus, 
int devfn, u64 gmfn)
     val = root_entry[bus].val;
     unmap_vtd_domain_page(root_entry);
     ctxt_entry = map_vtd_domain_page(val);
-    if ( ctxt_entry == NULL )
-    {
-        printk("    ctxt_entry == NULL\n");
-        return;
-    }
 
     val = ctxt_entry[devfn].lo;
     printk("    context[%02x] = %"PRIx64"_%"PRIx64"\n",
@@ -151,11 +141,6 @@ void print_vtd_entries(struct vtd_iommu *iommu, int bus, 
int devfn, u64 gmfn)
     do
     {
         l = map_vtd_domain_page(val);
-        if ( l == NULL )
-        {
-            printk("    l%u == NULL\n", level);
-            break;
-        }
         l_index = get_level_index(gmfn, level);
         pte.val = l[l_index];
         unmap_vtd_domain_page(l);
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.