diff mbox

powerpc/boot: allocate more memory for dtb

Message ID 20081101200056.GA23385@www.tglx.de (mailing list archive)
State Accepted, archived
Commit 5b4d2189446fd31cd618bbd1c24566b8d0ab11c8
Delegated to: Paul Mackerras
Headers show

Commit Message

Sebastian Andrzej Siewior Nov. 1, 2008, 8 p.m. UTC
* 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(-)

Comments

David Gibson Nov. 6, 2008, 12:16 a.m. UTC | #1
On Sat, Nov 01, 2008 at 09:00:56PM +0100, Sebastian Andrzej Siewior wrote:
> * 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>

Looks fine.

Acked-by: David Gibson <david@gibson.dropbear.id.au>

> 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");
diff mbox

Patch

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");