From patchwork Sat Nov 1 20:00:56 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 6813 X-Patchwork-Delegate: paulus@samba.org Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 4E526DDEEA for ; Sun, 2 Nov 2008 07:19:35 +1100 (EST) X-Original-To: linuxppc-dev@ozlabs.org Delivered-To: linuxppc-dev@ozlabs.org Received: from www.tglx.de (www.tglx.de [62.245.132.106]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8B896DDD0C for ; Sun, 2 Nov 2008 07:02:42 +1100 (EST) Received: from www.tglx.de (www.tglx.de [127.0.0.1]) by www.tglx.de (8.13.8/8.13.8/TGLX-2007100201) with ESMTP id mA1K13Cb026134 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 1 Nov 2008 21:01:03 +0100 Received: (from bigeasy@localhost) by www.tglx.de (8.13.8/8.13.8/Submit) id mA1K0uPA026124; Sat, 1 Nov 2008 21:00:56 +0100 Date: Sat, 1 Nov 2008 21:00:56 +0100 From: Sebastian Andrzej Siewior To: David Gibson Subject: [PATCH] powerpc/boot: allocate more memory for dtb Message-ID: <20081101200056.GA23385@www.tglx.de> References: <20080923203857.GB10935@www.tglx.de> <200809240146.m8O1kIpZ077447@sullivan.realtime.net> <20080925214357.GA2929@www.tglx.de> <1223611088.8157.144.camel@pasglop> <20081013091526.GA9925@www.tglx.de> <20081014015753.GD20620@yookeroo.seuss> <20081014020004.GE20620@yookeroo.seuss> Mime-Version: 1.0 Content-Disposition: inline In-Reply-To: <20081014020004.GE20620@yookeroo.seuss> User-Agent: Mutt/1.4.2.2i X-Key-Id: 97C4700B X-Key-Fingerprint: 09E2 D1F3 9A3A FF13 C3D3 961C 0688 1C1E 97C4 700B X-Virus-Scanned: ClamAV 0.93.2/8552/Sat Nov 1 02:14:36 2008 on www.tglx.de X-Virus-Status: Clean X-Spam-Status: No, score=-1.4 required=5.0 tests=ALL_TRUSTED,AWL autolearn=failed version=3.2.4 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on www.tglx.de Cc: Milton Miller , linuxppc-dev@ozlabs.org X-BeenThere: linuxppc-dev@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org * David Gibson | 2008-10-14 13:00:04 [+1100]: >Oh, one other thing. Since we are now unconditionally copying the dtb >into a malloc()ed buffer, possibly it would be sensible to add a >little padding to the buffer at that point, so that further device >tree manipulations won't need to reallocate it. Signed-off-by: Sebastian Andrzej Siewior Acked-by: David Gibson --- Haven't notice earlier that the other patch went mainline. EXPAND_GRANULARITY is 1KiB and it is used in expand_buf() if the buffer has to be increased. I hope that is okay. All other platforms except prpmc2800 are passing the dtb to fdt_init(). prpmc2800 is reallocating the dtb to a malloced area. I thing I can remove that part since fdt_init() is doing this anyway. arch/powerpc/boot/libfdt-wrapper.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/powerpc/boot/libfdt-wrapper.c b/arch/powerpc/boot/libfdt-wrapper.c index 1daa73f..0085930 100644 --- a/arch/powerpc/boot/libfdt-wrapper.c +++ b/arch/powerpc/boot/libfdt-wrapper.c @@ -179,7 +179,7 @@ void fdt_init(void *blob) /* Make sure the dt blob is the right version and so forth */ fdt = blob; - bufsize = fdt_totalsize(fdt) + 4; + bufsize = fdt_totalsize(fdt) + EXPAND_GRANULARITY; buf = malloc(bufsize); if(!buf) fatal("malloc failed. can't relocate the device tree\n\r");