We to some extent should tolerate R1_OUT_OF_RANGE for open-ending mode as it is expected behaviour and most of the backup partition tables should be located near some the last blocks which will always make open-ending read exceed the capcity of cards. Fixes: 9820a5b11101 ("mmc: core: for data errors, take response of stop cmd into account") Fixes: a04e6bae9e6f (mmc: core: check also R1 response for stop commands) Signed-off-by: Shawn Lin <shawn.lin@xxxxxxxxxxxxxx> --- drivers/mmc/core/block.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index 40f0d59..25343aa 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -1369,10 +1369,19 @@ static inline void mmc_apply_rel_rw(struct mmc_blk_request *brq, R1_CC_ERROR | /* Card controller error */ \ R1_ERROR) /* General/unknown error */ -static bool mmc_blk_has_cmd_err(struct mmc_command *cmd) +static bool mmc_blk_has_cmd_err(struct mmc_card *card, struct mmc_command *cmd) { - if (!cmd->error && cmd->resp[0] & CMD_ERRORS) - cmd->error = -EIO; + struct mmc_blk_data *md = dev_get_drvdata(&card->dev); + + if (!cmd->error && cmd->resp[0] & CMD_ERRORS) { + /* + * Prevent the OUT_OF_RANGE error for open-ending + * multiple block operations as it's normal behaviour. + */ + if (!(!(md->flags & MMC_BLK_CMD23) && + cmd->resp[0] & R1_OUT_OF_RANGE)) + cmd->error = -EIO; + } return cmd->error; } @@ -1398,8 +1407,8 @@ static enum mmc_blk_status mmc_blk_err_check(struct mmc_card *card, * stop.error indicates a problem with the stop command. Data * may have been transferred, or may still be transferring. */ - if (brq->sbc.error || brq->cmd.error || mmc_blk_has_cmd_err(&brq->stop) || - brq->data.error) { + if (brq->sbc.error || brq->cmd.error || + mmc_blk_has_cmd_err(card, &brq->stop) || brq->data.error) { switch (mmc_blk_cmd_recovery(card, req, brq, &ecc_err, &gen_err)) { case ERR_RETRY: return MMC_BLK_RETRY; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html