From patchwork Fri Aug 14 19:26:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 507561 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 874851401DE for ; Sat, 15 Aug 2015 05:26:59 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b=AlCyZDhW; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0D6F24B69A; Fri, 14 Aug 2015 21:26:57 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nIexyuJCN31s; Fri, 14 Aug 2015 21:26:56 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2E2994B668; Fri, 14 Aug 2015 21:26:56 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0DC094B668 for ; Fri, 14 Aug 2015 21:26:54 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SSKkJQdSIcve for ; Fri, 14 Aug 2015 21:26:53 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-io0-f176.google.com (mail-io0-f176.google.com [209.85.223.176]) by theia.denx.de (Postfix) with ESMTPS id 999A14B662 for ; Fri, 14 Aug 2015 21:26:49 +0200 (CEST) Received: by iodb91 with SMTP id b91so94660371iod.1 for ; Fri, 14 Aug 2015 12:26:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=o8KVQ91kfYnSDthMBTN0vIc1utNewvYyoZ7GtXw86Wg=; b=AlCyZDhWXtOvWbCwAMGpTnR04rYpEES7PJL6KidMfNrkJYc9FinvUNNdUaYsTlHz7D eQu6F89PD7HNPOlp4zILAaJM6LGv4hjXBakI8fr0aaAe5PV3K7ftoMjHPeS4D5LRd4nL 7QuF/45x1z5Zlk88CFT4hBn33tenUQXTdDhwB2QE8Sd//vt5JixYC2SiSPUfImvzX0ji 9lEy7PC8WRGp/7VkKraMFdsoDYC8meY8Y9wMM6xqzEuICbOA1exlhADY1O6a61Uviwtw DF9UnJlPxxSaHUwlKrAyIGiTjIeyvyH1t7lBIHlcLRbMAk+gaRJKJflu2BCICpxFFlPh de8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=o8KVQ91kfYnSDthMBTN0vIc1utNewvYyoZ7GtXw86Wg=; b=boMciWdQBWaoA4mmmGbFYlufyLbMZ4BIGA8EqUpTQaSeTPm09SCCDBPnBu3JWOeKl/ 4ogSTAtf6FPAG+76qdjKL0SUybkoBxbgbZILp1SXoj4S0YfKtGNfj6/Eki0gYSLW0t+Y sVK+pC+zRkyFvPk9E4A6xw2AMqcMcdJp1YcilCRHCG0NVyfkzPBs4T0sFEWPqErjP1Yw 0b1BtrUZLgvoDBMtfF8U5NnKqSqV8BlLNZUO5XgxhHlhGHxDaxUIzy4B3zKa/WVQ9Lza 9n8k8jkYqB4QG45GluEg86Py+V5bJRBfavVdopixVpolsDH8d2hNKPzrb4Qts9q9wzNd xnPg== X-Gm-Message-State: ALoCoQnOdL9Y6NsNvAqsQDDPop5F3jflXGOImFQv3T4+zL9icR26uFLa+sPrb0d5W+SLGnT/vttg X-Received: by 10.107.136.221 with SMTP id s90mr24932699ioi.34.1439580408416; Fri, 14 Aug 2015 12:26:48 -0700 (PDT) Received: from kaki.bld.corp.google.com ([172.29.216.32]) by smtp.gmail.com with ESMTPSA id p8sm3345739igh.1.2015.08.14.12.26.47 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Aug 2015 12:26:47 -0700 (PDT) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 4F425220E3B; Fri, 14 Aug 2015 13:26:46 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Fri, 14 Aug 2015 13:26:43 -0600 Message-Id: <1439580404-26574-1-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.5.0.276.gf5e568e Cc: Jagan Teki , Tom Rini , Joe Hershberger Subject: [U-Boot] [PATCH] malloc_simple: Correct the alignment logic in memalign_simple() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This should use the align parameter, not bytes. Natural alignment is one use case but should not be the only one supported by this function. Signed-off-by: Simon Glass Reviewed-by: Tom Rini --- common/malloc_simple.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/malloc_simple.c b/common/malloc_simple.c index 9811ab6..134e059 100644 --- a/common/malloc_simple.c +++ b/common/malloc_simple.c @@ -31,7 +31,7 @@ void *memalign_simple(size_t align, size_t bytes) ulong addr, new_ptr; void *ptr; - addr = ALIGN(gd->malloc_base + gd->malloc_ptr, bytes); + addr = ALIGN(gd->malloc_base + gd->malloc_ptr, align); new_ptr = addr + bytes; if (new_ptr > gd->malloc_limit) return NULL;