[U-Boot] [PATCH 2/3] dm: mmc: Ensure that block device is probed

Simon Glass sjg at chromium.org
Sat May 27 17:37:18 UTC 2017


Make sure that we probe the block device before using it when reading
the environment.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 common/env_mmc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/common/env_mmc.c b/common/env_mmc.c
index 1611886e22..3763b12278 100644
--- a/common/env_mmc.c
+++ b/common/env_mmc.c
@@ -98,7 +98,12 @@ static const char *init_mmc_for_env(struct mmc *mmc)
 	if (!mmc)
 		return "!No MMC card found";
 
-#ifndef CONFIG_BLK
+#ifdef CONFIG_BLK
+	struct udevice *dev;
+
+	if (blk_get_from_parent(mmc->dev, &dev))
+		return "!No block device";
+#else
 	if (mmc_init(mmc))
 		return "!MMC init failed";
 #endif
-- 
2.13.0.219.gdb65acc882-goog



More information about the U-Boot mailing list