All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Loehle <CLoehle@hyperstone.com>
To: "ulf.hansson@linaro.org" <ulf.hansson@linaro.org>,
	Avri Altman <Avri.Altman@wdc.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	"andriy.shevchenko@linux.intel.com" 
	<andriy.shevchenko@linux.intel.com>,
	Linux MMC List <linux-mmc@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH] mmc: block: Dont report successful writes with errors
Date: Tue, 19 Jul 2022 15:34:07 +0000	[thread overview]
Message-ID: <ca06b94aa48a484d965744e64e17a4ef@hyperstone.com> (raw)

Be as conservative about successful write reporting to the
block layer for SPI as with normal SD and MMC.
That means on any errors bytes_xfered is ignored and the
whole write must be repeated.

Signed-off-by: Christian Loehle <cloehle@hyperstone.com>
---
 drivers/mmc/core/block.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index f4a1281658db..63d1c05582a9 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -1765,8 +1765,12 @@ static bool mmc_blk_status_error(struct request *req, u32 status)
 	struct mmc_queue *mq = req->q->queuedata;
 	u32 stop_err_bits;
 
+	/*
+	 * Either write timed out during busy and data->error is set
+	 * or we actually received a valid R2 and check for error bits.
+	 */
 	if (mmc_host_is_spi(mq->card->host))
-		return false;
+		return brq->data.error || !!status;
 
 	stop_err_bits = mmc_blk_stop_err_bits(brq);
 
-- 
2.36.1

Hyperstone GmbH | Reichenaustr. 39a  | 78467 Konstanz
Managing Director: Dr. Jan Peter Berns.
Commercial register of local courts: Freiburg HRB381782


             reply	other threads:[~2022-07-19 15:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-19 15:34 Christian Loehle [this message]
2022-07-23  7:42 ` [PATCH] mmc: block: Dont report successful writes with errors Adrian Hunter
2022-07-23 15:08   ` Christian Loehle
2022-07-29 10:17     ` Adrian Hunter
2022-07-29 14:20       ` Christian Loehle
2022-08-08 12:10         ` Adrian Hunter

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=ca06b94aa48a484d965744e64e17a4ef@hyperstone.com \
    --to=cloehle@hyperstone.com \
    --cc=Avri.Altman@wdc.com \
    --cc=adrian.hunter@intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ulf.hansson@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.