From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Bang Li <libang.linuxer@gmail.com>
Cc: richard@nod.at, vigneshr@ti.com, linux-mtd@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mtdblock: tolerate corrected bit-flips
Date: Tue, 28 Mar 2023 14:58:48 +0200 [thread overview]
Message-ID: <20230328145848.5c7e4f14@xps-13> (raw)
In-Reply-To: <20230323140350.69908-1-libang.linuxer@gmail.com>
Hello,
libang.linuxer@gmail.com wrote on Thu, 23 Mar 2023 22:03:50 +0800:
> mtd_read() may return -EUCLEAN in case of corrected bit-flips.This
> particular condition should not be treated like an error.
I'm fine with the patch, Richard, are you okay as well?
> Signed-off-by: Bang Li <libang.linuxer@gmail.com>
> ---
> drivers/mtd/mtdblock.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mtd/mtdblock.c b/drivers/mtd/mtdblock.c
> index 1e94e7d10b8b..a0a1194dc1d9 100644
> --- a/drivers/mtd/mtdblock.c
> +++ b/drivers/mtd/mtdblock.c
> @@ -153,7 +153,7 @@ static int do_cached_write (struct mtdblk_dev *mtdblk, unsigned long pos,
> mtdblk->cache_state = STATE_EMPTY;
> ret = mtd_read(mtd, sect_start, sect_size,
> &retlen, mtdblk->cache_data);
> - if (ret)
> + if (ret && !mtd_is_bitflip(ret))
> return ret;
> if (retlen != sect_size)
> return -EIO;
> @@ -188,8 +188,12 @@ static int do_cached_read (struct mtdblk_dev *mtdblk, unsigned long pos,
> pr_debug("mtdblock: read on \"%s\" at 0x%lx, size 0x%x\n",
> mtd->name, pos, len);
>
> - if (!sect_size)
> - return mtd_read(mtd, pos, len, &retlen, buf);
> + if (!sect_size) {
> + ret = mtd_read(mtd, pos, len, &retlen, buf);
> + if (ret && !mtd_is_bitflip(ret))
> + return ret;
> + return 0;
> + }
>
> while (len > 0) {
> unsigned long sect_start = (pos/sect_size)*sect_size;
> @@ -209,7 +213,7 @@ static int do_cached_read (struct mtdblk_dev *mtdblk, unsigned long pos,
> memcpy (buf, mtdblk->cache_data + offset, size);
> } else {
> ret = mtd_read(mtd, pos, size, &retlen, buf);
> - if (ret)
> + if (ret && !mtd_is_bitflip(ret))
> return ret;
> if (retlen != size)
> return -EIO;
Thanks,
Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2023-03-28 12:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-23 14:03 [PATCH] mtdblock: tolerate corrected bit-flips Bang Li
2023-03-28 12:58 ` Miquel Raynal [this message]
2023-03-28 13:21 ` Richard Weinberger
2023-03-28 14:00 ` Miquel Raynal
-- strict thread matches above, loose matches on Subject: below --
2023-03-14 16:56 Bang Li
2023-03-22 16:08 ` Miquel Raynal
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=20230328145848.5c7e4f14@xps-13 \
--to=miquel.raynal@bootlin.com \
--cc=libang.linuxer@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=richard@nod.at \
--cc=vigneshr@ti.com \
/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