Skip to content

Commit

Permalink
Merge tag 'mmc-v5.17-rc1-2' of git://git.kernel.org/pub/scm/linux/ker…
Browse files Browse the repository at this point in the history
…nel/git/ulfh/mmc

Pull MMC fix from Ulf Hansson:
 "Fix recovery logic for multi block I/O reads (MMC_READ_MULTIPLE_BLOCK)"

* tag 'mmc-v5.17-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc:
  mmc: block: fix read single on recovery logic
  • Loading branch information
Linus Torvalds committed Feb 16, 2022
2 parents 3593030 + 54309fd commit f71077a
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions drivers/mmc/core/block.c
Original file line number Diff line number Diff line change
Expand Up @@ -1682,31 +1682,31 @@ static void mmc_blk_read_single(struct mmc_queue *mq, struct request *req)
struct mmc_card *card = mq->card;
struct mmc_host *host = card->host;
blk_status_t error = BLK_STS_OK;
int retries = 0;

do {
u32 status;
int err;
int retries = 0;

mmc_blk_rw_rq_prep(mqrq, card, 1, mq);
while (retries++ <= MMC_READ_SINGLE_RETRIES) {
mmc_blk_rw_rq_prep(mqrq, card, 1, mq);

mmc_wait_for_req(host, mrq);
mmc_wait_for_req(host, mrq);

err = mmc_send_status(card, &status);
if (err)
goto error_exit;

if (!mmc_host_is_spi(host) &&
!mmc_ready_for_data(status)) {
err = mmc_blk_fix_state(card, req);
err = mmc_send_status(card, &status);
if (err)
goto error_exit;
}

if (mrq->cmd->error && retries++ < MMC_READ_SINGLE_RETRIES)
continue;
if (!mmc_host_is_spi(host) &&
!mmc_ready_for_data(status)) {
err = mmc_blk_fix_state(card, req);
if (err)
goto error_exit;
}

retries = 0;
if (!mrq->cmd->error)
break;
}

if (mrq->cmd->error ||
mrq->data->error ||
Expand Down

0 comments on commit f71077a

Please sign in to comment.