Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6d7110bf authored by Maya Erez's avatar Maya Erez Committed by Matt Wagantall
Browse files

mmc: core: Avoid infinite retries of failed mmc command



With some bad SD cards, it is possible that the error recovery
procedure goes into a state where it retries the failed command
infinitely leading to CPU hog.

Fix inifinite retries when the bad SD card isn't responding to
a command even when the SD card reset mechanism is successful.

CRs-Fixed: 671153
Change-Id: Ic6db66b571aa425aec32c82d52789c68fe0cb0e9
Signed-off-by: default avatarSujit Reddy Thumma <sthumma@codeaurora.org>
[merez@codeaurora.org: fix conflicts due to removal of sanitize
from block.c in 3.14]
Signed-off-by: default avatarMaya Erez <merez@codeaurora.org>
parent 0f925803
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ MODULE_ALIAS("mmc:block");
#define PACKED_CMD_WR	0x02
#define PACKED_TRIGGER_MAX_ELEMENTS	5000

#define MMC_BLK_MAX_RETRIES 5 /* max # of retries before aborting a command */
#define MMC_BLK_UPDATE_STOP_REASON(stats, reason)			\
	do {								\
		if (stats->enabled)					\
@@ -2466,11 +2467,12 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc)
			}
			goto cmd_abort;
		case MMC_BLK_RETRY:
			if (retry++ < 5)
			if (retry++ < MMC_BLK_MAX_RETRIES)
				break;
			/* Fall through */
		case MMC_BLK_ABORT:
			if (!mmc_blk_reset(md, card->host, type))
			if (!mmc_blk_reset(md, card->host, type) &&
					(retry++ < (MMC_BLK_MAX_RETRIES + 1)))
					break;
			goto cmd_abort;
		case MMC_BLK_DATA_ERR: {