]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mmc: mv_sdhci: zero out sdhci_host structure
authorMatt Pelland <mpelland@starry.com>
Mon, 16 Apr 2018 14:08:18 +0000 (10:08 -0400)
committerStefan Roese <sr@denx.de>
Tue, 17 Apr 2018 08:39:30 +0000 (10:39 +0200)
The mv_sdhci driver was not zeroing the sdhci_host structure it
allocates causing random access violations in parts of the mmc core
where the "ops" member pointers are checked and called if not NULL.

Signed-off-by: Matt Pelland <mpelland@starry.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
drivers/mmc/mv_sdhci.c

index 69aa87babe13089057454d8e9c655cc8eb2d93db..0ed0d38c90295f5d74d177c87ccb029c926d9529 100644 (file)
@@ -68,7 +68,7 @@ static char *MVSDH_NAME = "mv_sdh";
 int mv_sdh_init(unsigned long regbase, u32 max_clk, u32 min_clk, u32 quirks)
 {
        struct sdhci_host *host = NULL;
-       host = (struct sdhci_host *)malloc(sizeof(struct sdhci_host));
+       host = calloc(1, sizeof(*host));
        if (!host) {
                printf("sdh_host malloc fail!\n");
                return -ENOMEM;