summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRamon Fried <ramon.fried@gmail.com>2018-05-14 15:02:30 +0300
committerTom Rini <trini@konsulko.com>2018-05-14 21:28:38 -0400
commitb70fe965bb4c780f27efcc7aac0fd845c1825305 (patch)
treec5853fde4b28da0e66e5efb33a50123d8a2bac9d
parented52ea507f120738b180d1a18a2945412b0ddb63 (diff)
mmc: sdhci: Check that ops are defined
The check is necessary to avoid NULL pointer dereference. Signed-off-by: Ramon Fried <ramon.fried@gmail.com> Reviewed-by: Michal Simek <michal.simek@xilinx.com>
-rw-r--r--drivers/mmc/sdhci.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index 8971a1122c..400f87e134 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -314,7 +314,7 @@ static int sdhci_execute_tuning(struct udevice *dev, uint opcode)
debug("%s\n", __func__);
- if (host->ops->platform_execute_tuning) {
+ if (host->ops && host->ops->platform_execute_tuning) {
err = host->ops->platform_execute_tuning(mmc, opcode);
if (err)
return err;
@@ -347,7 +347,7 @@ static int sdhci_set_clock(struct mmc *mmc, unsigned int clock)
if (clock == 0)
return 0;
- if (host->ops->set_delay)
+ if (host->ops && host->ops->set_delay)
host->ops->set_delay(host);
if (SDHCI_GET_VERSION(host) >= SDHCI_SPEC_300) {