From: Wolfgang Denk Date: Thu, 14 Oct 2010 11:30:35 +0200 Subject: [U-Boot] RFC: introduce malloc_cleared() ? In-Reply-To: <4CB6C3D3.7050403@emk-elektronik.de> References: <4CB6A110.6080101@emk-elektronik.de> <20101014081302.226391365CF@gemini.denx.de> <4CB6C3D3.7050403@emk-elektronik.de> Message-ID: <20101014093035.1ABCA134F26@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 Reinhard Meyer, In message <4CB6C3D3.7050403@emk-elektronik.de> you wrote: > > > And why exactly does calloc() not fit? > > It has two parameters... Produces more code to always supply an > extra "1"... Ah. > But for malloc() in such driver init situations, another code saving > function with error message would be more effective. I don't see any Would it? You still need to check the return code of the allocation function then, because you want to breeak out of the caller. > possible way of continuing u-boot when malloc() for a relatively small > structure already fails, and a (apparently) needed driver cannot be > initialized. Maybe, maybe not. As mentioned before: network access may not be so important at all. > I am not talking about malloc()'s for buffers or similar where continuing > of u-boot might be possible. Continuing U-Boot without network access is also possible. If someone pulls the cable you also continue, or don't you? 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 "Pardon me for breathing, which I never do anyway so I don't know why I bother to say it, oh God, I'm so depressed. Here's another of those self-satisfied doors. Life! Don't talk to me about life." - Marvin the Paranoid Android