From: sashiko-bot@kernel.org
To: "Mehmet Fide" <mehmet.fide@gmail.com>,
"Miquel Raynal" <miquel.raynal@bootlin.com>
Cc: "Stefan Agner" <stefan@agner.ch>,
"Richard Weinberger" <richard@nod.at>,
"Vignesh Raghavendra" <vigneshr@ti.com>,
"Boris Brezillon" <bbrezillon@kernel.org>,
"Brian Norris" <computersforpeace@gmail.com>,
"Alexey Klimov" <alexey.klimov@linaro.org>,
linux-mtd@lists.infradead.org, mehmet.fide@screeningeagle.com
Subject: Re: [PATCH v2 3/3] mtd: rawnand: vf610_nfc: return an error when a command times out
Date: Sat, 14 Nov 2026 19:30:09 +0000 [thread overview]
Message-ID: <sashiko-outbox-214971@kernel.org> (raw)
In-Reply-To: <20261114192031.959376-4-mehmet.fide@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] mtd: rawnand: vf610_nfc: -ETIMEDOUT swallowed in
vf610_nfc_read_page()
--
commit 74e97975b0439f2b30c793e3dba498249fb4705a
Author: Mehmet Fide <mehmet.fide@screeningeagle.com>
mtd: rawnand: vf610_nfc: return an error when a command times out
This commit returns -ETIMEDOUT from vf610_nfc_done() on command timeout and
propagates the error through vf610_nfc_run(), vf610_nfc_cmd(), and the page
read and write hooks.
> diff --git a/drivers/mtd/nand/raw/vf610_nfc.c b/drivers/mtd/nand/raw/vf610_nfc.c
> index 547eb15138939..d6d4a18432ce8 100644
> --- a/drivers/mtd/nand/raw/vf610_nfc.c
> +++ b/drivers/mtd/nand/raw/vf610_nfc.c
[ ... ]
> @@ -572,7 +577,7 @@ static int vf610_nfc_read_page(struct nand_chip *chip, uint8_t *buf,
> struct mtd_info *mtd = nand_to_mtd(chip);
> int trfr_sz = mtd->writesize + vf610_nfc_spare_size(mtd);
> u32 row = 0, cmd1 = 0, cmd2 = 0, code = 0;
> - int stat;
> + int stat, ret;
>
> vf610_nfc_select_target(chip, chip->cur_cs);
>
> @@ -587,8 +592,10 @@ static int vf610_nfc_read_page(struct nand_chip *chip, uint8_t *buf,
> cmd2 |= code << CMD_CODE_SHIFT;
>
> vf610_nfc_ecc_mode(nfc, nfc->ecc_mode);
> - vf610_nfc_run(nfc, 0, row, cmd1, cmd2, trfr_sz);
> + ret = vf610_nfc_run(nfc, 0, row, cmd1, cmd2, trfr_sz);
> vf610_nfc_ecc_mode(nfc, ECC_BYPASS);
> + if (ret)
> + return ret;
[Severity: Medium]
Does vf610_nfc_read_page() swallow -ETIMEDOUT when a timeout occurs during
the raw re-read in vf610_nfc_correct_data()?
When hardware ECC reports a decode failure (such as on an erased page),
vf610_nfc_correct_data() re-reads the page and OOB via nand_read_page_op()
and nand_read_oob_op(), which now return -ETIMEDOUT through vf610_nfc_cmd():
drivers/mtd/nand/raw/vf610_nfc.c:vf610_nfc_correct_data() {
...
nfc->data_access = true;
ret = nand_read_page_op(&nfc->chip, page, 0, dat, mtd->writesize);
if (!ret)
ret = nand_read_oob_op(&nfc->chip, page, 0, oob,
vf610_nfc_spare_size(mtd));
nfc->data_access = false;
if (ret)
return ret;
...
}
drivers/mtd/nand/raw/vf610_nfc.c:vf610_nfc_read_page() {
...
stat = vf610_nfc_correct_data(chip, buf, chip->oob_poi, page);
if (stat < 0) {
mtd->ecc_stats.failed++;
return 0;
} else {
...
}
Because vf610_nfc_read_page() treats any negative stat as an uncorrectable
ECC failure, a timeout in vf610_nfc_correct_data() increments
mtd->ecc_stats.failed and returns 0, leaving the bogus ECC-corrected SRAM
data in buf and reporting -EBADMSG to the caller instead of aborting with
-ETIMEDOUT. Only stat == -EBADMSG should be counted as an ECC failure,
while other negative errors should be returned directly.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261114192031.959376-1-mehmet.fide@gmail.com?part=3
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
prev parent reply other threads:[~2026-11-14 19:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-14 19:20 [PATCH v2 0/3] mtd: rawnand: vf610_nfc: fix the OOB of written pages and command timeouts Mehmet Fide
2026-11-14 19:20 ` Mehmet Fide
2026-11-14 19:20 ` [PATCH v2 1/3] mtd: rawnand: vf610_nfc: write the OOB bytes on page writes Mehmet Fide
2026-11-14 19:20 ` Mehmet Fide
2026-11-14 19:20 ` [PATCH v2 2/3] mtd: rawnand: vf610_nfc: keep a timed-out command from completing the next one Mehmet Fide
2026-11-14 19:20 ` Mehmet Fide
2026-11-14 19:20 ` [PATCH v2 3/3] mtd: rawnand: vf610_nfc: return an error when a command times out Mehmet Fide
2026-11-14 19:20 ` Mehmet Fide
2026-11-14 19:30 ` sashiko-bot [this message]
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=sashiko-outbox-214971@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=alexey.klimov@linaro.org \
--cc=bbrezillon@kernel.org \
--cc=computersforpeace@gmail.com \
--cc=linux-mtd@lists.infradead.org \
--cc=mehmet.fide@gmail.com \
--cc=mehmet.fide@screeningeagle.com \
--cc=miquel.raynal@bootlin.com \
--cc=richard@nod.at \
--cc=sashiko-reviews@lists.linux.dev \
--cc=stefan@agner.ch \
--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 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.