From patchwork Mon Jan 9 20:53:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mans Rullgard X-Patchwork-Id: 6106 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 5CE5423E07 for ; Mon, 9 Jan 2012 20:53:57 +0000 (UTC) Received: from mail-ey0-f180.google.com (mail-ey0-f180.google.com [209.85.215.180]) by fiordland.canonical.com (Postfix) with ESMTP id 45845A18046 for ; Mon, 9 Jan 2012 20:53:57 +0000 (UTC) Received: by eaac11 with SMTP id c11so2966962eaa.11 for ; Mon, 09 Jan 2012 12:53:57 -0800 (PST) Received: by 10.204.149.130 with SMTP id t2mr3320296bkv.9.1326142436962; Mon, 09 Jan 2012 12:53:56 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.205.82.144 with SMTP id ac16cs65692bkc; Mon, 9 Jan 2012 12:53:56 -0800 (PST) Received: by 10.180.101.101 with SMTP id ff5mr7483661wib.14.1326142434790; Mon, 09 Jan 2012 12:53:54 -0800 (PST) Received: from unicorn.mansr.com (unicorn.mansr.com. [78.86.181.103]) by mx.google.com with ESMTP id k5si4695113wiy.16.2012.01.09.12.53.54; Mon, 09 Jan 2012 12:53:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of mru@mansr.com designates 78.86.181.103 as permitted sender) client-ip=78.86.181.103; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of mru@mansr.com designates 78.86.181.103 as permitted sender) smtp.mail=mru@mansr.com Received: by unicorn.mansr.com (Postfix, from userid 51770) id B39361539B; Mon, 9 Jan 2012 20:53:53 +0000 (GMT) From: Mans Rullgard To: andy.green@linaro.org Cc: linaro-dev@lists.linaro.org, patches@linaro.org, linaro-mm-sig@lists.linaro.org Subject: [PATCH] cma: fix limit adjustment in dma_declare_contiguous() Date: Mon, 9 Jan 2012 20:53:12 +0000 Message-Id: <1326142392-5060-1-git-send-email-mans.rullgard@linaro.org> X-Mailer: git-send-email 1.7.8.3 The upper limit needs to be rounded down to a multiple of the alignment, not up. Signed-off-by: Mans Rullgard --- 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) {