iommu/omap: Use WARN_ON for page table alignment check
authorSuman Anna <s-anna@ti.com>
Mon, 4 Apr 2016 22:46:20 +0000 (17:46 -0500)
committerJoerg Roedel <jroedel@suse.de>
Tue, 5 Apr 2016 15:53:20 +0000 (17:53 +0200)
The OMAP IOMMU page table needs to be aligned on a 16K boundary,
and the current code uses a BUG_ON on the alignment sanity check
in the .domain_alloc() ops implementation. Replace this with a
less severe WARN_ON and bail out gracefully.

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/omap-iommu.c

index f6cf728ee32ac4bf8beeadcc43ee50c79d876843..e2583cce2cc12bc59c4b08ee8769ee4f423c660b 100644 (file)
@@ -1162,7 +1162,8 @@ static struct iommu_domain *omap_iommu_domain_alloc(unsigned type)
         * should never fail, but please keep this around to ensure
         * we keep the hardware happy
         */
-       BUG_ON(!IS_ALIGNED((long)omap_domain->pgtable, IOPGD_TABLE_SIZE));
+       if (WARN_ON(!IS_ALIGNED((long)omap_domain->pgtable, IOPGD_TABLE_SIZE)))
+               goto fail_align;
 
        clean_dcache_area(omap_domain->pgtable, IOPGD_TABLE_SIZE);
        spin_lock_init(&omap_domain->lock);
@@ -1173,6 +1174,8 @@ static struct iommu_domain *omap_iommu_domain_alloc(unsigned type)
 
        return &omap_domain->domain;
 
+fail_align:
+       kfree(omap_domain->pgtable);
 fail_nomem:
        kfree(omap_domain);
 out:
This page took 0.027503 seconds and 5 git commands to generate.