Message ID | 20211207043116.27319-1-yf.wang@mediatek.com |
---|---|
State | New |
Headers | show |
Series | [v2] iommu/io-pgtable-arm-v7s: Add error handle for page table allocation failure | expand |
diff --git a/drivers/iommu/io-pgtable-arm-v7s.c b/drivers/iommu/io-pgtable-arm-v7s.c index bfb6acb651e5..d84240308f4b 100644 --- a/drivers/iommu/io-pgtable-arm-v7s.c +++ b/drivers/iommu/io-pgtable-arm-v7s.c @@ -246,6 +246,12 @@ static void *__arm_v7s_alloc_table(int lvl, gfp_t gfp, __GFP_ZERO | ARM_V7S_TABLE_GFP_DMA, get_order(size)); else if (lvl == 2) table = kmem_cache_zalloc(data->l2_tables, gfp); + + if (!table) { + dev_err(dev, "Page table allocation failure lvl:%d\n", lvl); + return NULL; + } + phys = virt_to_phys(table); if (phys != (arm_v7s_iopte)phys) { /* Doesn't fit in PTE */