mxc_fec: avoid free() calls to already freed pointers.
authorjavier Martin <javier.martin@vista-silicon.com>
Thu, 29 Oct 2009 07:22:43 +0000 (08:22 +0100)
committerBen Warren <biggerbadderben@gmail.com>
Wed, 11 Nov 2009 21:27:09 +0000 (13:27 -0800)
commit651ef90fa6ca824c8e581aeef9e04bbbe7f7e9ce
tree3b286703c38e68298cabe6bf15df6faa08d554f5
parente8f1546a88b4ade6a910c4a7958a774ee1b40023
mxc_fec: avoid free() calls to already freed pointers.

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 initializes those pointers to NULL and allocates them only
the first time. This way we can get rid of free calls in halt callback.

This has been tested in i.MX27 Litekit board and eldk-4.2 toolchains.

Signed-off-by: Javier Martin <javier.martin@vista-silicon.com>
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
drivers/net/fec_mxc.c