aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorAdrian McMenamin <adrian@mcmen.demon.co.uk>2009-01-21 04:47:38 -0500
committerPaul Mundt <lethal@linux-sh.org>2009-01-21 04:47:38 -0500
commitcdf57cab27aef72f13a19c86858c6cac9951dc24 (patch)
tree86226edbbe82c3f3ddca7e1ad929037e2f0ea6ad /kernel
parent2afb447f33c29cb000a494396559f8005d3e33c1 (diff)
dma-coherent: per-device coherent area is in pages, not bytes.
Commit 58c6d3dfe436eb8cfb451981d8fdc9044eaf42da ("dma-coherent: catch oversized requests to dma_alloc_from_coherent()") attempted to add a sanity check to bail out on allocations larger than the coherent area. Unfortunately when this was implemented, the fact the coherent area is tracked in pages rather than bytes was overlooked, which subsequently broke every single dma_alloc_from_coherent() user, forcing the allocation silently through generic memory instead. Signed-off-by: Adrian McMenamin <adrian@mcmen.demon.co.uk > Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/dma-coherent.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/dma-coherent.c b/kernel/dma-coherent.c
index 038707404b76..38fa292c6aa9 100644
--- a/kernel/dma-coherent.c
+++ b/kernel/dma-coherent.c
@@ -118,8 +118,8 @@ int dma_alloc_from_coherent(struct device *dev, ssize_t size,
118 mem = dev->dma_mem; 118 mem = dev->dma_mem;
119 if (!mem) 119 if (!mem)
120 return 0; 120 return 0;
121 if (unlikely(size > mem->size)) 121 if (unlikely(size > (mem->size << PAGE_SHIFT)))
122 return 0; 122 return 0;
123 123
124 pageno = bitmap_find_free_region(mem->bitmap, mem->size, order); 124 pageno = bitmap_find_free_region(mem->bitmap, mem->size, order);
125 if (pageno >= 0) { 125 if (pageno >= 0) {