aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm64')
-rw-r--r--arch/arm64/mm/dma-mapping.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
index 4bd7579ec9e6..83e643131e10 100644
--- a/arch/arm64/mm/dma-mapping.c
+++ b/arch/arm64/mm/dma-mapping.c
@@ -33,6 +33,11 @@ static void *arm64_swiotlb_alloc_coherent(struct device *dev, size_t size,
33 dma_addr_t *dma_handle, gfp_t flags, 33 dma_addr_t *dma_handle, gfp_t flags,
34 struct dma_attrs *attrs) 34 struct dma_attrs *attrs)
35{ 35{
36 if (dev == NULL) {
37 WARN_ONCE(1, "Use an actual device structure for DMA allocation\n");
38 return NULL;
39 }
40
36 if (IS_ENABLED(CONFIG_ZONE_DMA32) && 41 if (IS_ENABLED(CONFIG_ZONE_DMA32) &&
37 dev->coherent_dma_mask <= DMA_BIT_MASK(32)) 42 dev->coherent_dma_mask <= DMA_BIT_MASK(32))
38 flags |= GFP_DMA32; 43 flags |= GFP_DMA32;
@@ -43,6 +48,11 @@ static void arm64_swiotlb_free_coherent(struct device *dev, size_t size,
43 void *vaddr, dma_addr_t dma_handle, 48 void *vaddr, dma_addr_t dma_handle,
44 struct dma_attrs *attrs) 49 struct dma_attrs *attrs)
45{ 50{
51 if (dev == NULL) {
52 WARN_ONCE(1, "Use an actual device structure for DMA allocation\n");
53 return;
54 }
55
46 swiotlb_free_coherent(dev, size, vaddr, dma_handle); 56 swiotlb_free_coherent(dev, size, vaddr, dma_handle);
47} 57}
48 58