[U-Boot] [PATCH] mmc/dwmmc: Using calloc instead malloc

Alexey Brodkin Alexey.Brodkin at synopsys.com
Wed Dec 18 16:22:07 CET 2013


On Wed, 2013-12-18 at 09:08 -0600, Chin Liang See wrote:
> To enhance the SDMMC DesignWare driver to use calloc instead of
> malloc. This will avoid the incident that uninitialized members
> of mmc structure are later used for NULL comparison.
> 

IMHO pretty sane change.

Actually I had local memset right after this malloc to make sure all
members are zeroed.

But with this change we have a clean structure right away.

I'm wondering why "calloc" is not used in every driver for device
specific structure allocation.

-Alexey


More information about the U-Boot mailing list