[U-Boot] [u-boot] [PATCH] [2/2] [v1.2] mxc_fec: avoid free() calls to already freed pointers.

Ben Warren biggerbadderben at gmail.com
Sun Oct 25 20:28:42 CET 2009


Javier,


On Mon, Oct 19, 2009 at 10:48 PM, javier Martin <
javier.martin at vista-silicon.com> wrote:

> Sometimes, inside NetLoop, eth_halt() is called before eth_init() has
> been called. This is harmless except for free() calls to pointers
> which have not been allocated yet. This patch adds two states to
> distinguish when it is necessary to call free() and when it is not.
>
> IMHO we should aim to make this driver less complicated, not more.  Do we
really need to malloc and free each time this interface is turned on or off?
 Why not just initialize the pointers to NULL, and malloc() only the first
time the init() function is called?  You could then get rid of the free()
calls in the halt function.

U-boot is very transient in nature.  Once we launch a kernel all the memory
essentially gets freed anyway.

regards,
Ben


More information about the U-Boot mailing list