ARM: dma-mapping: Skip cache maint for invalid page
[linux-3.10.git] / arch / arm / mm / dma-mapping.c
index 2d0a5a6..062e384 100644 (file)
@@ -1726,6 +1726,9 @@ static void arm_iommu_unmap_page(struct device *dev, dma_addr_t handle,
        if (!iova)
                return;
 
+       if (WARN_ON(!pfn_valid(page_to_pfn(page))))
+               return;
+
        if (!dma_get_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs))
                __dma_page_dev_to_cpu(page, offset, size, dir);
 
@@ -1744,6 +1747,9 @@ static void arm_iommu_sync_single_for_cpu(struct device *dev,
        if (!iova)
                return;
 
+       if (WARN_ON(!pfn_valid(page_to_pfn(page))))
+               return;
+
        __dma_page_dev_to_cpu(page, offset, size, dir);
 }
 
@@ -1758,6 +1764,9 @@ static void arm_iommu_sync_single_for_device(struct device *dev,
        if (!iova)
                return;
 
+       if (WARN_ON(!pfn_valid(page_to_pfn(page))))
+               return;
+
        __dma_page_cpu_to_dev(page, offset, size, dir);
 }