]> Git Repo - u-boot.git/commitdiff
mmc/dwmmc: Using calloc instead malloc
authorChin Liang See <[email protected]>
Wed, 18 Dec 2013 17:16:01 +0000 (11:16 -0600)
committerPantelis Antoniou <[email protected]>
Wed, 8 Jan 2014 17:02:41 +0000 (19:02 +0200)
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 <[email protected]>
Cc: Rajeshwari Shinde <[email protected]>
Cc: Jaehoon Chung <[email protected]>
Cc: Mischa Jonker <[email protected]>
Cc: Alexey Brodkin <[email protected]>
Cc: Andy Fleming <[email protected]>
Cc: Pantelis Antoniou <[email protected]>
Acked-by: Pantelis Antoniou <[email protected]>
drivers/mmc/dw_mmc.c [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 19d9b0b..82abe19
@@ -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;
        }
 
This page took 0.029346 seconds and 4 git commands to generate.