diff options
| author | Heinrich Schuchardt <[email protected]> | 2018-03-17 22:49:36 +0000 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2018-04-23 10:49:58 -0400 |
| commit | f6549c85410668e73503221ce6147d049cc6251d (patch) | |
| tree | 69c02b590b7f862a92c40d854ad4cd1f2451ca2e | |
| parent | 275d80a4c2fb63890f3f4c16b7ad481064e650a0 (diff) | |
mmc: avoid division by zero in meson_mmc_config_clock
The Odroid C2 fails to read from mmc with U-Boot v2018.03.
The change avoids a division by zero.
The fix was suggested by Jaehoon in
https://lists.denx.de/pipermail/u-boot/2018-January/318577.html
Reported-by: Vagrant Cascadian <[email protected]>
Suggested-by: Jaehoon Chung <[email protected]>
Signed-off-by: Heinrich Schuchardt <[email protected]>
Tested-by: Vagrant Cascadian <[email protected]>
| -rw-r--r-- | drivers/mmc/meson_gx_mmc.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/mmc/meson_gx_mmc.c b/drivers/mmc/meson_gx_mmc.c index a2cd5d3a446..454593eec43 100644 --- a/drivers/mmc/meson_gx_mmc.c +++ b/drivers/mmc/meson_gx_mmc.c @@ -35,6 +35,9 @@ static void meson_mmc_config_clock(struct mmc *mmc) uint32_t meson_mmc_clk = 0; unsigned int clk, clk_src, clk_div; + if (!mmc->clock) + return; + /* 1GHz / CLK_MAX_DIV = 15,9 MHz */ if (mmc->clock > 16000000) { clk = SD_EMMC_CLKSRC_DIV2; |
