linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: Milton Miller <miltonm@bga.com>, linuxppc-dev@ozlabs.org
Subject: [PATCH] powerpc/boot: allocate more memory for dtb
Date: Sat, 1 Nov 2008 21:00:56 +0100	[thread overview]
Message-ID: <20081101200056.GA23385@www.tglx.de> (raw)
In-Reply-To: <20081014020004.GE20620@yookeroo.seuss>

* 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 <bigeasy@linutronix.de>
---
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");
-- 
1.5.6.5

  reply	other threads:[~2008-11-01 20:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-23 20:38 [RFC] powerpc/boot: compare _start against ei.loadsize instead ei.memsize Sebastian Siewior
2008-09-24  1:46 ` Milton Miller
2008-09-25 10:21   ` Sebastian Siewior
2008-09-25 21:43   ` Sebastian Siewior
2008-10-10  3:58     ` Benjamin Herrenschmidt
2008-10-13  9:15       ` [PATCH] " Sebastian Andrzej Siewior
2008-10-14  1:57         ` David Gibson
2008-10-14  2:00           ` David Gibson
2008-11-01 20:00             ` Sebastian Andrzej Siewior [this message]
2008-11-06  0:16               ` [PATCH] powerpc/boot: allocate more memory for dtb David Gibson
2008-09-25 18:15 ` [RFC] powerpc/boot: compare _start against ei.loadsize instead ei.memsize Scott Wood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081101200056.GA23385@www.tglx.de \
    --to=bigeasy@linutronix.de \
    --cc=david@gibson.dropbear.id.au \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=miltonm@bga.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).