Make sure that we probe the block device before using it when reading the environment.
Signed-off-by: Simon Glass <s...@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 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot