Commit 01b73fe63078e5bb1d375dc7d66e6f67893d3305
Committed by
Jaehoon Chung
1 parent
9f103b9cb5
Exists in
smarc_8mq_lf_v2020.04
and in
20 other branches
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
common/env_mmc.c
| ... | ... | @@ -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 |