diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2017-11-29 14:41:11 +0100 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2017-12-11 12:44:37 +0100 |
commit | 7701885e56cee3de4447c0653f9059b62844983b (patch) | |
tree | 63bffd2eced64aa18cb069ecb1b41985cbbe409d /drivers/mmc | |
parent | mmc: block: blk-mq: Check error bits and save the exception bit when polling ... (diff) | |
download | linux-7701885e56cee3de4447c0653f9059b62844983b.tar.xz linux-7701885e56cee3de4447c0653f9059b62844983b.zip |
mmc: block: Check the timeout correctly in card_busy_detect()
Pedantically, ensure the status is checked for the last time after the full
timeout has passed.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/core/block.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index c446d17b48c4..f7c387c27ac0 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -931,6 +931,8 @@ static int card_busy_detect(struct mmc_card *card, unsigned int timeout_ms, u32 status; do { + bool done = time_after(jiffies, timeout); + err = __mmc_send_status(card, &status, 5); if (err) { pr_err("%s: error %d requesting status\n", @@ -951,7 +953,7 @@ static int card_busy_detect(struct mmc_card *card, unsigned int timeout_ms, * Timeout if the device never becomes ready for data and never * leaves the program state. */ - if (time_after(jiffies, timeout)) { + if (done) { pr_err("%s: Card stuck in programming state! %s %s\n", mmc_hostname(card->host), req->rq_disk->disk_name, __func__); |