[U-Boot] [PATCH] env_mmc: fix buffer allocation for armv7
Wolfgang Denk
wd at denx.de
Sat Oct 5 21:57:28 CEST 2013
Dear Tom Rini,
In message <20131004170203.GL15917 at bill-the-cat> you wrote:
>
> I really don't like this. We're now allocating for example 256KiB on
> the stack, rather than malloc. I posted a patch recently to convert the
> non-redundant case to malloc instead for this reason. I believe the
> answer is we need to be using memalign here, like
> common/bouncebuf.c::bounce_buffer_start does. Can you do this? If not,
> can you test a patch? Thanks.
What exactly don't you like in using the stack for temporary data
buffers? That's what it has been invented for. Using malloc() is
only useful when the allocated buffers neet to be kept across file
scope, which appears not to be the case here.
For file scope buffers, usign the satck is the most efficient and
preferred approach - it's fast and results in minimal (virtually no)
code.
Why do you hesitate to use the stack?
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
Humanity has the stars in its future, and that future is too
important to be lost under the burden of juvenile folly and ignorant
superstition. - Isaac Asimov
More information about the U-Boot
mailing list