summaryrefslogtreecommitdiff
path: root/drivers/mtd/nand/raw/davinci_nand.c
diff options
context:
space:
mode:
authorPaul Cercueil <paul@crapouillou.net>2021-10-16 16:22:25 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-01-27 13:02:49 +0300
commit3f5eb2d8903216b14be26ca98bc477dbf7522f1c (patch)
treeed2c545022ac8b39d8e9e1774a3e6dc73a9a7c6a /drivers/mtd/nand/raw/davinci_nand.c
parenteebc910e09d48f1f47670993c29389f728c5e4c6 (diff)
downloadlinux-3f5eb2d8903216b14be26ca98bc477dbf7522f1c.tar.xz
mtd: rawnand: davinci: Avoid duplicated page read
commit 9c9d709965385de5a99f84b14bd5860e1541729e upstream. The function nand_davinci_read_page_hwecc_oob_first() first reads the OOB data, extracts the ECC information, programs the ECC hardware before reading the actual data in a loop. Right after the OOB data was read, it called nand_read_page_op() to reset the read cursor to the beginning of the page. This caused the first page to be read twice: in that call, and later in the loop. Address that issue by changing the call to nand_read_page_op() to nand_change_read_column_op(), which will only reset the read cursor. Cc: <stable@vger.kernel.org> # v5.2 Fixes: a0ac778eb82c ("mtd: rawnand: ingenic: Add support for the JZ4740") Signed-off-by: Paul Cercueil <paul@crapouillou.net> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20211016132228.40254-2-paul@crapouillou.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/mtd/nand/raw/davinci_nand.c')
-rw-r--r--drivers/mtd/nand/raw/davinci_nand.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/mtd/nand/raw/davinci_nand.c b/drivers/mtd/nand/raw/davinci_nand.c
index 89de24d3bb7a..2e6a0c1671be 100644
--- a/drivers/mtd/nand/raw/davinci_nand.c
+++ b/drivers/mtd/nand/raw/davinci_nand.c
@@ -401,7 +401,8 @@ static int nand_davinci_read_page_hwecc_oob_first(struct nand_chip *chip,
if (ret)
return ret;
- ret = nand_read_page_op(chip, page, 0, NULL, 0);
+ /* Move read cursor to start of page */
+ ret = nand_change_read_column_op(chip, 0, NULL, 0, false);
if (ret)
return ret;