From ebe78bb993423851b947b1e00f76c835c23e29b5 Mon Sep 17 00:00:00 2001 From: Alexander Stein Date: Fri, 17 Apr 2015 17:33:17 +0200 Subject: 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 --- drivers/mmc/bcm2835_sdhci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/mmc/bcm2835_sdhci.c') diff --git a/drivers/mmc/bcm2835_sdhci.c b/drivers/mmc/bcm2835_sdhci.c index 4ec2968ece..56775131f0 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; } -- cgit From 33fe2fb8df01647f97a7bce96a1c7781a7f6d253 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Mon, 4 May 2015 22:54:36 +0200 Subject: ARM: mmc: bcm283x: Remove get_timer_us() from mmc driver The get_timer_us() function is something which is no longer existing in case we use generic timer framework, so replace it with get_timer(). Signed-off-by: Marek Vasut Cc: Stephen Warren Cc: Tyler Baker --- drivers/mmc/bcm2835_sdhci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/mmc/bcm2835_sdhci.c') diff --git a/drivers/mmc/bcm2835_sdhci.c b/drivers/mmc/bcm2835_sdhci.c index 56775131f0..078ef0523a 100644 --- a/drivers/mmc/bcm2835_sdhci.c +++ b/drivers/mmc/bcm2835_sdhci.c @@ -69,11 +69,11 @@ static inline void bcm2835_sdhci_raw_writel(struct sdhci_host *host, u32 val, * (Which is just as well - otherwise we'd have to nobble the DMA engine * too) */ - while (get_timer_us(bcm_host->last_write) < bcm_host->twoticks_delay) + while (get_timer(bcm_host->last_write) < bcm_host->twoticks_delay) ; writel(val, host->ioaddr + reg); - bcm_host->last_write = get_timer_us(0); + bcm_host->last_write = get_timer(0); } static inline u32 bcm2835_sdhci_raw_readl(struct sdhci_host *host, int reg) -- cgit