The upper limit needs to be rounded down to a multiple of the
alignment, not up.

Signed-off-by: Mans Rullgard <mans.rullg...@linaro.org>
---
 drivers/base/dma-contiguous.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/base/dma-contiguous.c b/drivers/base/dma-contiguous.c
index 924c052..e10120f 100644
--- a/drivers/base/dma-contiguous.c
+++ b/drivers/base/dma-contiguous.c
@@ -256,7 +256,7 @@ int __init dma_declare_contiguous(struct device *dev, 
unsigned long size,
        alignment = PAGE_SIZE << max(MAX_ORDER, pageblock_order);
        base = ALIGN(base, alignment);
        size = ALIGN(size, alignment);
-       limit = ALIGN(limit, alignment);
+       limit &= ~(alignment - 1);
 
        /* Reserve memory */
        if (base) {
-- 
1.7.8.3


_______________________________________________
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev

Reply via email to