diff options
author | Alexander Stein <alexanders83@web.de> | 2015-04-17 17:33:17 +0200 |
---|---|---|
committer | Pantelis Antoniou <pantelis.antoniou@konsulko.com> | 2015-05-05 12:29:42 +0300 |
commit | ebe78bb993423851b947b1e00f76c835c23e29b5 (patch) | |
tree | 7af19e2973d93a4ec00750627e9d5e0255de009d | |
parent | 253d5bdd64504a1a569b4eb330555e2449fa3d3f (diff) | |
download | u-boot-imx-ebe78bb993423851b947b1e00f76c835c23e29b5.zip u-boot-imx-ebe78bb993423851b947b1e00f76c835c23e29b5.tar.gz u-boot-imx-ebe78bb993423851b947b1e00f76c835c23e29b5.tar.bz2 |
mmc: bcm2835_sdhci: Use calloc to allocate bcm2835_sdhci_host
We need to clear the allocated memory explicitly as the included
struct sdhci_host has function pointers. Those are compared to NULL to
test if this (optional) feature is supported. Leaving them undefined let
u-boot jump to arbitrary memory.
Signed-off-by: Alexander Stein <alexanders83@web.de>
-rw-r--r-- | drivers/mmc/bcm2835_sdhci.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mmc/bcm2835_sdhci.c b/drivers/mmc/bcm2835_sdhci.c index 4ec2968..5677513 100644 --- a/drivers/mmc/bcm2835_sdhci.c +++ b/drivers/mmc/bcm2835_sdhci.c @@ -154,9 +154,9 @@ int bcm2835_sdhci_init(u32 regbase, u32 emmc_freq) struct bcm2835_sdhci_host *bcm_host; struct sdhci_host *host; - bcm_host = malloc(sizeof(*bcm_host)); + bcm_host = calloc(1, sizeof(*bcm_host)); if (!bcm_host) { - printf("sdhci_host malloc fail!\n"); + printf("sdhci_host calloc fail!\n"); return 1; } |