From: Wolfgang Denk Date: Wed, 26 Jan 2011 19:30:42 +0100 Subject: [U-Boot] [PATCH] Make it possible to allocate physical address 0 with lmb In-Reply-To: <20110126165340.14306.98359.stgit@localhost6.localdomain6> References: <20110126165340.14306.98359.stgit@localhost6.localdomain6> Message-ID: <20110126183042.11F0CCD1385@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Grant Likely, In message <20110126165340.14306.98359.stgit@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 ... > --- 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