[PATCH dtc] Fix reserve map output for asm format.

David Gibson david at gibson.dropbear.id.au
Sun Apr 15 10:44:17 EST 2007


On Sat, Apr 14, 2007 at 06:15:27PM -0400, Jerry Van Baren wrote:
> Add extra reserve map slots output for asm format (previously done for dtb
>   output).
> Use cmalloc to pre-zero memory (for dtb input) and handle dtb (binary)
>   input being shorter than the total blob length (result of putting
>   extra space in the blob).
> 
> Signed-off-by: Gerald Van Baren <vanbaren at cideas.com>
> ---
> 
> Hi Jon:
> 
> Some simple fixes for handling extra reserve slots and extra space in
> the blob.
> 
> Best regards,
> gvb
> 
>  dtc.h      |    4 ++--
>  flattree.c |   14 +++++++++++---
>  2 files changed, 13 insertions(+), 5 deletions(-)
> 
> diff --git a/dtc.h b/dtc.h
> index 8cfe1a1..e77f9d1 100644
> --- a/dtc.h
> +++ b/dtc.h
> @@ -55,10 +55,10 @@ static inline void die(char * str, ...)
>  
>  static inline void *xmalloc(size_t len)
>  {
> -	void *new = malloc(len);
> +	void *new = calloc(len, 1);
>  
>  	if (! new)
> -		die("malloc() failed\n");
> +		die("calloc() failed\n");
>  
>  	return new;
>  }

I'm less that thrilled about this change.  There's a semi-standard
definition of "xmalloc()" and using callc() isn't it.  I'd prefer the
clearing was done in the caller.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson



More information about the Linuxppc-dev mailing list