Skip to content

Commit d33b43a

Browse files
Christophe Kerellofourmone
authored andcommitted
mmc: mmci: stm32: fix max busy timeout calculation
The way that the timeout is currently calculated could lead to a u64 timeout value. this value is then cast in a u32 register that leads to mmc erase failed issue with some SD cards. Change-Id: Ibe2682ba42e878c30b61471672800f5fc04ce87c Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com> Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/linux-stm32/+/311057 Tested-by: Eric FOURMONT <eric.fourmont-ext@st.com> Reviewed-by: Eric FOURMONT <eric.fourmont-ext@st.com> Domain-Review: Eric FOURMONT <eric.fourmont-ext@st.com>
1 parent e689673 commit d33b43a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/mmc/host/mmci.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1746,7 +1746,8 @@ static void mmci_set_max_busy_timeout(struct mmc_host *mmc)
17461746
return;
17471747

17481748
if (host->variant->busy_timeout && mmc->actual_clock)
1749-
max_busy_timeout = ~0UL / (mmc->actual_clock / MSEC_PER_SEC);
1749+
max_busy_timeout = U32_MAX / DIV_ROUND_UP(mmc->actual_clock,
1750+
MSEC_PER_SEC);
17501751

17511752
mmc->max_busy_timeout = max_busy_timeout;
17521753
}

0 commit comments

Comments
 (0)