linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dma: fix up broken comparison in dma_alloc_from_coherent
@ 2009-01-20 21:48 Adrian McMenamin
  2009-01-20 21:55 ` Adrian McMenamin
  0 siblings, 1 reply; 12+ messages in thread
From: Adrian McMenamin @ 2009-01-20 21:48 UTC (permalink / raw)
  To: LKML
  Cc: Paul Mundt, Andrew Morton, linux-sh, penberg, dbaryshkov,
	penguin-kernel, Adrian McMenamin

Currently this code compares a size in bytes with a size in pages.
This patch makes both sides of the comparison bytes.


Previous code (introduced in commit
58c6d3dfe436eb8cfb451981d8fdc9044eaf42da) brakes Dreamcast, this code
has been tested and works on the Dreamcast.

Signed-off-by: Adrian McMenamin <adrian@mcmen.demon.co.uk>
---

diff --git a/kernel/dma-coherent.c b/kernel/dma-coherent.c
index 0387074..8114dd7 100644
--- a/kernel/dma-coherent.c
+++ b/kernel/dma-coherent.c
@@ -112,13 +112,13 @@ int dma_alloc_from_coherent(struct device *dev,
ssize_t size,
 	struct dma_coherent_mem *mem;
 	int order = get_order(size);
 	int pageno;

 	if (!dev)
 		return 0;
 	mem = dev->dma_mem;
 	if (!mem)
 		return 0;
-	if (unlikely(size > mem->size))
+	if (unlikely(size > mem->size << PAGE_SHIFT))
  		return 0;

 	pageno = bitmap_find_free_region(mem->bitmap, mem->size, order);

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2009-02-06 22:31 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-20 21:48 [PATCH] dma: fix up broken comparison in dma_alloc_from_coherent Adrian McMenamin
2009-01-20 21:55 ` Adrian McMenamin
2009-01-21  3:39   ` Paul Mundt
2009-01-21  8:11     ` Paul Mundt
2009-01-21  8:29       ` Guennadi Liakhovetski
2009-01-21  8:30         ` Paul Mundt
2009-01-27 21:48       ` Andrew Morton
2009-01-27 22:54         ` Paul Mundt
2009-01-28  8:36           ` Guennadi Liakhovetski
2009-02-06 12:22             ` [PATCH] fix broken size test in bitmap_find_free_region() Guennadi Liakhovetski
2009-02-06 21:29               ` Andrew Morton
2009-02-06 22:30                 ` Guennadi Liakhovetski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).