exynos: Properly zero initialize host in s5p_sdhci_init()
authorTobias Jakobi <tjakobi@math.uni-bielefeld.de>
Mon, 5 Oct 2015 11:47:50 +0000 (13:47 +0200)
committerMinkyu Kang <mk7.kang@samsung.com>
Tue, 13 Oct 2015 11:22:28 +0000 (20:22 +0900)
This makes sure that setting the host_caps in s5p_sdhci_core_init()
doesn't operate on potentially uninitialized memory.

Acked-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
drivers/mmc/s5p_sdhci.c

index 4db51d6488aa319335c8ebfb395528ab85ae24e3..911e7a83077f403c704ffa571bc5ddfa2f8ebb6d 100644 (file)
@@ -84,9 +84,9 @@ static int s5p_sdhci_core_init(struct sdhci_host *host)
 
 int s5p_sdhci_init(u32 regbase, int index, int bus_width)
 {
-       struct sdhci_host *host = malloc(sizeof(struct sdhci_host));
+       struct sdhci_host *host = calloc(1, sizeof(struct sdhci_host));
        if (!host) {
-               printf("sdhci__host malloc fail!\n");
+               printf("sdhci__host allocation fail!\n");
                return 1;
        }
        host->ioaddr = (void *)regbase;