mmc: block: don't start new request when the card is removed
Seungwon Jeon [Tue, 22 Jan 2013 10:48:07 +0000 (19:48 +0900)]
It's not necessary to start a new request while error handling if
the card was removed.

Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
(cherry picked from commit 7a81902fa52f2b6f5037e167f74ebb5a41cfc7d1)

Bug 1242730

Change-Id: Ia585664bc4125af9b0f121237f79ed3e5d45c910
Signed-off-by: Naveen Kumar Arepalli <naveenk@nvidia.com>
Reviewed-on: http://git-master/r/206930
Reviewed-by: Mandar Padmawar <mpadmawar@nvidia.com>
Tested-by: Mandar Padmawar <mpadmawar@nvidia.com>

drivers/mmc/card/block.c

index 09d7fa3..ed247a0 100644 (file)
@@ -1394,8 +1394,14 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc)
                ret = blk_end_request(req, -EIO, blk_rq_cur_bytes(req));
  start_new_req:
        if (rqc) {
-               mmc_blk_rw_rq_prep(mq->mqrq_cur, card, 0, mq);
-               mmc_start_req(card->host, &mq->mqrq_cur->mmc_active, NULL);
+               if (mmc_card_removed(card)) {
+                       rqc->cmd_flags |= REQ_QUIET;
+                       blk_end_request_all(rqc, -EIO);
+               } else {
+                       mmc_blk_rw_rq_prep(mq->mqrq_cur, card, 0, mq);
+                       mmc_start_req(card->host,
+                                     &mq->mqrq_cur->mmc_active, NULL);
+               }
        }
 
        return 0;