提交 22d7e85f 编写于 作者: R Robin van der Gracht 提交者: Ulf Hansson

mmc: core: Fixed bug in one erase-group budget TRIM

When requesting a trim for several bytes, everything up to the next
erase-group is erased. This causes data corruption.
Signed-off-by: NRobin van der Gracht <robin@protonic.nl>
Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
上级 0df9d2ea
......@@ -2227,9 +2227,8 @@ int mmc_erase(struct mmc_card *card, unsigned int from, unsigned int nr,
* and call mmc_do_erase() twice if necessary. This special case is
* identified by the card->eg_boundary flag.
*/
if ((arg & MMC_TRIM_ARGS) && (card->eg_boundary) &&
(from % card->erase_size)) {
rem = card->erase_size - (from % card->erase_size);
rem = card->erase_size - (from % card->erase_size);
if ((arg & MMC_TRIM_ARGS) && (card->eg_boundary) && (nr > rem)) {
err = mmc_do_erase(card, from, from + rem - 1, arg);
from += rem;
if ((err) || (to <= from))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册