From patchwork Tue Jan 20 21:48:00 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian McMenamin X-Patchwork-Id: 3342 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n0KLoYq6026991 for ; Tue, 20 Jan 2009 13:50:36 -0800 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751385AbZATVy7 (ORCPT ); Tue, 20 Jan 2009 16:54:59 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751739AbZATVy7 (ORCPT ); Tue, 20 Jan 2009 16:54:59 -0500 Received: from mail-bw0-f21.google.com ([209.85.218.21]:44421 "EHLO mail-bw0-f21.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750939AbZATVy6 (ORCPT ); Tue, 20 Jan 2009 16:54:58 -0500 Received: by bwz14 with SMTP id 14so11737081bwz.13 for ; Tue, 20 Jan 2009 13:54:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=6EjPT9OyZUJUazMp6GYhS18yZyEQw4IliTeccLJJeJg=; b=uqdHeJWrIxEOaife5JsV/voBFBs3/2yvLMj96Z1Ct3S1KXKiQ9R7moDCxgZa4RDW3X Zgd6yDTEY2pB9ViN78nKiOhC3Z/DihD9vpBXxGYp8xoAYAsRYHXZgUybT/APX+8n5Qhp nH3nglQZoApcP/q8CRqdySRWsMschK665HLlg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=CCtVt6WFKJWFtAL61BVPNv8lwJ0lnlL4RdnN6GLZMKuqETFr1GPvWgbf/fDr9sO07R 9PWyt/f+k/7296KV2hv56EIl9Kfbdp1y5ZqVsqFu/mStCOifv6Uw2XipJwsNLITgG14M g4vcuFbsjqDki4pkQDxeMvG+uDzZv8ejtpAQU= MIME-Version: 1.0 Received: by 10.181.48.4 with SMTP id a4mr740612bkk.59.1232488080361; Tue, 20 Jan 2009 13:48:00 -0800 (PST) Date: Tue, 20 Jan 2009 21:48:00 +0000 Message-ID: <8b67d60901201348r6a59928dw3fcf8c9c823d5c68@mail.gmail.com> Subject: [PATCH] dma: fix up broken comparison in dma_alloc_from_coherent From: Adrian McMenamin To: LKML Cc: Paul Mundt , Andrew Morton , linux-sh , penberg@cs.helsinki.fi, dbaryshkov@gmail.com, penguin-kernel@i-love.sakura.ne.jp, Adrian McMenamin Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org 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 --- pageno = bitmap_find_free_region(mem->bitmap, mem->size, order); -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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;