Message ID | 20170527173719.25679-3-sjg@chromium.org |
---|---|
State | Accepted |
Commit | 01b73fe63078e5bb1d375dc7d66e6f67893d3305 |
Delegated to: | Jaehoon Chung |
Headers | show |
On Sat, May 27, 2017 at 11:37:18AM -0600, Simon Glass wrote: > 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>
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
Make sure that we probe the block device before using it when reading the environment. Signed-off-by: Simon Glass <sjg@chromium.org> --- common/env_mmc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)