From: Chin Liang See Date: Wed, 18 Dec 2013 17:16:01 +0000 (-0600) Subject: mmc/dwmmc: Using calloc instead malloc X-Git-Tag: v2014.01-rc3~10^2~5 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=fd26b5490bef8e8a37e33a9b3c4960d7a8734067;p=u-boot mmc/dwmmc: Using calloc instead malloc 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. Signed-off-by: Chin Liang See Cc: Rajeshwari Shinde Cc: Jaehoon Chung Cc: Mischa Jonker Cc: Alexey Brodkin Cc: Andy Fleming Cc: Pantelis Antoniou Acked-by: Pantelis Antoniou --- diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c old mode 100644 new mode 100755 index 19d9b0b899..82abe19eab --- a/drivers/mmc/dw_mmc.c +++ b/drivers/mmc/dw_mmc.c @@ -336,9 +336,9 @@ int add_dwmci(struct dwmci_host *host, u32 max_clk, u32 min_clk) struct mmc *mmc; int err = 0; - mmc = malloc(sizeof(struct mmc)); + mmc = calloc(sizeof(struct mmc), 1); if (!mmc) { - printf("mmc malloc fail!\n"); + printf("mmc calloc fail!\n"); return -1; }