MIPS: KVM: Relative branch to common exit handler
[deliverable/linux.git] / drivers / iommu / omap-iommu.c
index c05d48f88596bf803159529b3a4509d23d344bb6..e2583cce2cc12bc59c4b08ee8769ee4f423c660b 100644 (file)
@@ -628,10 +628,12 @@ iopgtable_store_entry_core(struct omap_iommu *obj, struct iotlb_entry *e)
                break;
        default:
                fn = NULL;
-               BUG();
                break;
        }
 
+       if (WARN_ON(!fn))
+               return -EINVAL;
+
        prot = get_iopte_attr(e);
 
        spin_lock(&obj->page_table_lock);
@@ -1160,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);
@@ -1171,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.027533 seconds and 5 git commands to generate.