aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mm/dma-mapping.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mm/dma-mapping.c')
-rw-r--r--arch/arm/mm/dma-mapping.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 50be842e89fd..e4e7f6cba1ab 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -120,9 +120,8 @@ static void __dma_free_buffer(struct page *page, size_t size)
120 120
121#ifdef CONFIG_MMU 121#ifdef CONFIG_MMU
122 122
123
124#define CONSISTENT_OFFSET(x) (((unsigned long)(x) - consistent_base) >> PAGE_SHIFT) 123#define CONSISTENT_OFFSET(x) (((unsigned long)(x) - consistent_base) >> PAGE_SHIFT)
125#define CONSISTENT_PTE_INDEX(x) (((unsigned long)(x) - consistent_base) >> PGDIR_SHIFT) 124#define CONSISTENT_PTE_INDEX(x) (((unsigned long)(x) - consistent_base) >> PMD_SHIFT)
126 125
127/* 126/*
128 * These are the page tables (2MB each) covering uncached, DMA consistent allocations 127 * These are the page tables (2MB each) covering uncached, DMA consistent allocations
@@ -206,7 +205,7 @@ static int __init consistent_init(void)
206 } 205 }
207 206
208 consistent_pte[i++] = pte; 207 consistent_pte[i++] = pte;
209 base += (1 << PGDIR_SHIFT); 208 base += PMD_SIZE;
210 } while (base < CONSISTENT_END); 209 } while (base < CONSISTENT_END);
211 210
212 return ret; 211 return ret;
@@ -347,6 +346,8 @@ __dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp,
347 346
348 if (addr) 347 if (addr)
349 *handle = pfn_to_dma(dev, page_to_pfn(page)); 348 *handle = pfn_to_dma(dev, page_to_pfn(page));
349 else
350 __dma_free_buffer(page, size);
350 351
351 return addr; 352 return addr;
352} 353}