summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorChin Liang See <[email protected]>2013-12-18 11:16:01 -0600
committerPantelis Antoniou <[email protected]>2014-01-08 19:02:41 +0200
commitfd26b5490bef8e8a37e33a9b3c4960d7a8734067 (patch)
tree2b1f2e05311e25cce469c7e3cdaa142819a91bdf /drivers
parentdae6c6ba95f61326e8012c2fec372a6735ba46b9 (diff)
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 <[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]>
Diffstat (limited to 'drivers')
-rwxr-xr-x[-rw-r--r--]drivers/mmc/dw_mmc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c
index 19d9b0b899c..82abe19eaba 100644..100755
--- 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;
}