[U-Boot] [PATCH] Make it possible to allocate physical address 0 with lmb

Wolfgang Denk wd at denx.de
Wed Jan 26 19:30:42 CET 2011


Dear Grant Likely,

In message <20110126165340.14306.98359.stgit at localhost6.localdomain6> you wrote:
> LMB doesn't currently handle allocating regions based at physical
> address 0.  This patch reworks the lmb_alloc functions to return
> all ones when allocation fails instead of zero so that callers can
> differentiate between a region allocated at zero and a failed
> allocation
> 
> Signed-off-by: Grant Likely <grant.likely at secretlab.ca>
...
> --- a/lib/lmb.c
> +++ b/lib/lmb.c
> @@ -114,6 +114,9 @@ static long lmb_add_region(struct lmb_region *rgn, phys_addr_t base, phys_size_t
...
> -	if (alloc == 0)
> -		printf("ERROR: Failed to allocate 0x%lx bytes below 0x%lx.\n",
> +	if (alloc == LMB_ALLOC_ERROR) {
> +		debug("ERROR: Failed to allocate 0x%lx bytes below 0x%lx.\n",
>  		      (ulong)size, (ulong)max_addr);
> +		lmb_dump_all(lmb);
> +	}

Do you intentionally change the printf() into a debug() here?  If yes,
what is your rationale for not printing a proper error message in
production code?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"I knew then (in 1970) that a 4-kbyte minicomputer would cost as much
as a house. So I reasoned  that  after  college,  I'd  have  to  live
cheaply in an apartment and put all my money into owning a computer."
      - Apple co-founder Steve Wozniak, EE Times, June 6, 1988, pg 45


More information about the U-Boot mailing list