Commit 01b73fe63078e5bb1d375dc7d66e6f67893d3305

Authored by Simon Glass
Committed by Jaehoon Chung
1 parent 9f103b9cb5

dm: mmc: Ensure that block device is probed

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

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>

Showing 1 changed file with 6 additions and 1 deletions Side-by-side Diff

... ... @@ -121,7 +121,12 @@
121 121 if (!mmc)
122 122 return "!No MMC card found";
123 123  
124   -#ifndef CONFIG_BLK
  124 +#ifdef CONFIG_BLK
  125 + struct udevice *dev;
  126 +
  127 + if (blk_get_from_parent(mmc->dev, &dev))
  128 + return "!No block device";
  129 +#else
125 130 if (mmc_init(mmc))
126 131 return "!MMC init failed";
127 132 #endif