mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-11 00:04:33 +08:00
mmc: mmci: stm32: fix max busy timeout calculation
commit47b3ad6b78
upstream. The way that the timeout is currently calculated could lead to a u64 timeout value in mmci_start_command(). This value is then cast in a u32 register that leads to mmc erase failed issue with some SD cards. Fixes:8266c585f4
("mmc: mmci: add hardware busy timeout feature") Signed-off-by: Yann Gautier <yann.gautier@foss.st.com> Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20230613134146.418016-1-yann.gautier@foss.st.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
999173f295
commit
acee272283
@ -1729,7 +1729,8 @@ static void mmci_set_max_busy_timeout(struct mmc_host *mmc)
|
||||
return;
|
||||
|
||||
if (host->variant->busy_timeout && mmc->actual_clock)
|
||||
max_busy_timeout = ~0UL / (mmc->actual_clock / MSEC_PER_SEC);
|
||||
max_busy_timeout = U32_MAX / DIV_ROUND_UP(mmc->actual_clock,
|
||||
MSEC_PER_SEC);
|
||||
|
||||
mmc->max_busy_timeout = max_busy_timeout;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user