Commit 836bfa0d authored by YoungJun Cho's avatar YoungJun Cho Committed by Marek Szyprowski

ARM: dma-mapping: Get pages if the cpu_addr is out of atomic_pool

In __iommu_get_pages(), the cpu_addr is checked wheather in
atomic_pool range or not. So if the cpu_addr is in atomic_pool
range, it does not need to check twice.
Signed-off-by: default avatarYoungJun Cho <yj44.cho@samsung.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
parent 9e895ace
...@@ -1372,16 +1372,17 @@ static int arm_iommu_mmap_attrs(struct device *dev, struct vm_area_struct *vma, ...@@ -1372,16 +1372,17 @@ static int arm_iommu_mmap_attrs(struct device *dev, struct vm_area_struct *vma,
void arm_iommu_free_attrs(struct device *dev, size_t size, void *cpu_addr, void arm_iommu_free_attrs(struct device *dev, size_t size, void *cpu_addr,
dma_addr_t handle, struct dma_attrs *attrs) dma_addr_t handle, struct dma_attrs *attrs)
{ {
struct page **pages = __iommu_get_pages(cpu_addr, attrs); struct page **pages;
size = PAGE_ALIGN(size); size = PAGE_ALIGN(size);
if (!pages) { if (__in_atomic_pool(cpu_addr, size)) {
WARN(1, "trying to free invalid coherent area: %p\n", cpu_addr); __iommu_free_atomic(dev, cpu_addr, handle, size);
return; return;
} }
if (__in_atomic_pool(cpu_addr, size)) { pages = __iommu_get_pages(cpu_addr, attrs);
__iommu_free_atomic(dev, cpu_addr, handle, size); if (!pages) {
WARN(1, "trying to free invalid coherent area: %p\n", cpu_addr);
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment