mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Roopesh <roopesh@cyberspace.org>
To: linux-kernel@vger.kernel.org
Cc: Pierre Ossman <drzeus-list@drzeus.cx>
Subject: MMC/SD: Write operation in invalid states by borken cards.
Date: Thu, 8 Nov 2007 03:24:10 -0500	[thread overview]
Message-ID: <20071108082410.GA1875@grex.cyberspace.org> (raw)

 Hi, 

 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)

diff -a -u -p -r1.2 block.c
--- drivers/mmc/card/block.c	22 Oct 2007 10:39:44 -0000	1.2
+++ drivers/mmc/card/block.c	8 Nov 2007 06:55:37 -0000
@@ -206,6 +206,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);
 
@@ -282,19 +283,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 (rq_data_dir(req) != READ) {
@@ -320,6 +321,9 @@ static int mmc_blk_issue_rq(struct mmc_q
 				goto cmd_err;
 #endif
 		}
+
+		if (data_error == 1)
+			goto cmd_err;
 
 		/*
 		 * A block was successfully transferred.
 

 Thanks,
 Roopesh.

             reply	other threads:[~2007-11-08  8:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-08  8:24 Roopesh [this message]
2007-11-10 10:51 ` Pierre Ossman
2007-11-23 10:27   ` Roopesh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071108082410.GA1875@grex.cyberspace.org \
    --to=roopesh@cyberspace.org \
    --cc=drzeus-list@drzeus.cx \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®