From: Roopesh If a write operation fails, shouldnt we still check for the card state to be 'ready to accept next data'? This question is because I have noticed that some (broken) cards fail the write command, and the immediately issued subsequent commands also fail since the card state was never checked before sending these commands. (There was a discussion about these cards at the thread: "MMC: CRC Errors with 2GB cards) Cc: Pierre Ossman Signed-off-by: Andrew Morton --- drivers/mmc/card/block.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff -puN drivers/mmc/card/block.c~mmc-sd-write-operation-in-invalid-states-by-borken-cards drivers/mmc/card/block.c --- a/drivers/mmc/card/block.c~mmc-sd-write-operation-in-invalid-states-by-borken-cards +++ a/drivers/mmc/card/block.c @@ -208,6 +208,7 @@ static int mmc_blk_issue_rq(struct mmc_q struct mmc_card *card = md->queue.card; struct mmc_blk_request brq; int ret = 1, sg_pos, data_size; + int data_error = 0; mmc_claim_host(card->host); @@ -293,19 +294,19 @@ static int mmc_blk_issue_rq(struct mmc_q if (brq.cmd.error) { printk(KERN_ERR "%s: error %d sending read/write command\n", req->rq_disk->disk_name, brq.cmd.error); - goto cmd_err; + data_error = 1; } if (brq.data.error) { printk(KERN_ERR "%s: error %d transferring data\n", req->rq_disk->disk_name, brq.data.error); - goto cmd_err; + data_error = 1; } if (brq.stop.error) { printk(KERN_ERR "%s: error %d sending stop command\n", req->rq_disk->disk_name, brq.stop.error); - goto cmd_err; + data_error = 1; } if (!mmc_host_is_spi(card->host) && rq_data_dir(req) != READ) { @@ -338,6 +339,9 @@ static int mmc_blk_issue_rq(struct mmc_q #endif } + if (data_error == 1) + goto cmd_err; + /* * A block was successfully transferred. */ _