Merge tag 'iommu-fixes-v5.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / drivers / iommu / mtk_iommu_v1.c
index 6ede4286b835a93c61906605bf7a46f2c2297cbd..7e0df67bd3e976077102ec659f4cb21d3a26652a 100644 (file)
@@ -232,9 +232,8 @@ static int mtk_iommu_domain_finalise(struct mtk_iommu_data *data)
 
        spin_lock_init(&dom->pgtlock);
 
-       dom->pgt_va = dma_zalloc_coherent(data->dev,
-                               M2701_IOMMU_PGT_SIZE,
-                               &dom->pgt_pa, GFP_KERNEL);
+       dom->pgt_va = dma_alloc_coherent(data->dev, M2701_IOMMU_PGT_SIZE,
+                                        &dom->pgt_pa, GFP_KERNEL);
        if (!dom->pgt_va)
                return -ENOMEM;
 
@@ -442,6 +441,10 @@ static int mtk_iommu_add_device(struct device *dev)
                iommu_spec.args_count = count;
 
                mtk_iommu_create_mapping(dev, &iommu_spec);
+
+               /* dev->iommu_fwspec might have changed */
+               fwspec = dev_iommu_fwspec_get(dev);
+
                of_node_put(iommu_spec.np);
        }