From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: linux-mtd@lists.infradead.org,
Richard Weinberger <richard@nod.at>,
Brian Norris <computersforpeace@gmail.com>,
kernel@pengutronix.de
Subject: Re: [PATCH] mtd: tests: nandbiterrs: Fix read_page return value
Date: Tue, 9 Jan 2018 10:31:12 +0100 [thread overview]
Message-ID: <20180109103112.2cc8681c@bbrezillon> (raw)
In-Reply-To: <20180109090938.29760-1-s.hauer@pengutronix.de>
On Tue, 9 Jan 2018 10:09:38 +0100
Sascha Hauer <s.hauer@pengutronix.de> wrote:
> The number of corrected bitflips is not correctly reported by
> the test until the bitflip threshold is reached.
>
> read_page() shall return the number of corrected bitflips, but
> mtd_read() returns 0 or a negative error, so we can't forward
> its return value. In the absence of an error we always have
> calculate the number of bitflips ourselves.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> drivers/mtd/tests/nandbiterrs.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/tests/nandbiterrs.c b/drivers/mtd/tests/nandbiterrs.c
> index 5f03b8c885a9..11e39ab4a810 100644
> --- a/drivers/mtd/tests/nandbiterrs.c
> +++ b/drivers/mtd/tests/nandbiterrs.c
> @@ -152,15 +152,16 @@ static int read_page(int log)
>
> err = mtd_read(mtd, offset, mtd->writesize, &read, rbuffer);
> if (err == -EUCLEAN)
Why not just replacing the above test by
if (!err || err == -EUCLEAN)
> - err = mtd->ecc_stats.corrected - oldstats.corrected;
> + err = 0;
>
> if (err < 0 || read != mtd->writesize) {
> pr_err("error: read failed at %#llx\n", (long long)offset);
> if (err >= 0)
> err = -EIO;
> + return err;
> }
>
> - return err;
> + return mtd->ecc_stats.corrected - oldstats.corrected;
> }
>
> /* Verifies rbuffer against random sequence */
next prev parent reply other threads:[~2018-01-09 9:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-09 9:09 [PATCH] mtd: tests: nandbiterrs: Fix read_page return value Sascha Hauer
2018-01-09 9:31 ` Boris Brezillon [this message]
2018-01-09 9:47 ` Sascha Hauer
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=20180109103112.2cc8681c@bbrezillon \
--to=boris.brezillon@free-electrons.com \
--cc=computersforpeace@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-mtd@lists.infradead.org \
--cc=richard@nod.at \
--cc=s.hauer@pengutronix.de \
/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