Blob Blame History Raw
From patchwork Tue Mar 27 17:53:55 2018
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: [U-Boot] mmc: mv_sdhci: zero out sdhci_host structure
X-Patchwork-Submitter: Matt Pelland <mpelland@starry.com>
X-Patchwork-Id: 891784
Message-Id: <20180327175355.29633-1-mpelland@starry.com>
To: u-boot@lists.denx.de
Date: Tue, 27 Mar 2018 13:53:55 -0400
From: Matt Pelland <mpelland@starry.com>
List-Id: U-Boot discussion <u-boot.lists.denx.de>

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>
---
 drivers/mmc/mv_sdhci.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mmc/mv_sdhci.c b/drivers/mmc/mv_sdhci.c
index 69aa87babe..afc03f75a0 100644
--- a/drivers/mmc/mv_sdhci.c
+++ b/drivers/mmc/mv_sdhci.c
@@ -74,6 +74,8 @@ int mv_sdh_init(unsigned long regbase, u32 max_clk, u32 min_clk, u32 quirks)
 		return -ENOMEM;
 	}
 
+	memset(host, 0, sizeof(struct sdhci_host));
+
 	host->name = MVSDH_NAME;
 	host->ioaddr = (void *)regbase;
 	host->quirks = quirks;