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

Wolfgang Denk wd at denx.de
Tue Oct 20 12:41:50 CEST 2009


Dear javier Martin,

In message <eedb5540910192248j2c8f45edq4f36763737dcc692 at mail.gmail.com> you 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.
> 
> This has been tested in i.MX27 Litekit board and eldk-4.2 toolchains.

Thanks.

>  /**
> + * @brief Possible values for status
> + *
> + * fec_halt() changes the status to FEC_HALT_STATUS and fec_init()
> + * changes the status to FEC_INIT_STATUS
> + */
> +#define FEC_HALT_STATUS 0
> +#define FEC_INIT_STATUS 1

It would seem more logical to me if you swapped names around, i. e.
please use FEC_STATUS_INIT and FEC_STATUS_HALT.

Also, we might consider using an enum here?

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
Dear Lord: I just want *one* one-armed manager so  I  never  have  to
hear "On the other hand", again.


More information about the U-Boot mailing list