diff options
author | Daniel Golle <daniel@makrotopia.org> | 2023-03-11 02:38:59 +0000 |
---|---|---|
committer | Daniel Golle <daniel@makrotopia.org> | 2023-03-27 19:07:54 +0100 |
commit | 5f898483af574699783ed81a7a7895414c94de07 (patch) | |
tree | dfa51ffeec1b444f462edfb22174e17c34fdf725 /target | |
parent | 540377010532d9840ebe0778c2af991bd4b67052 (diff) | |
download | upstream-5f898483af574699783ed81a7a7895414c94de07.tar.gz upstream-5f898483af574699783ed81a7a7895414c94de07.tar.bz2 upstream-5f898483af574699783ed81a7a7895414c94de07.zip |
generic: fix Macronix SPI-NAND driver
Use scratch buffer for DMA operetations. Passing a pointer to a stack
variable won't work and results in bogus bit flips being reported.
Patch was submitted upstream and is part of Linux 6.3.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Diffstat (limited to 'target')
-rw-r--r-- | target/linux/generic/backport-5.15/423-v6.3-mtd-spinand-macronix-use-scratch-buffer-for-DMA-oper.patch | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/target/linux/generic/backport-5.15/423-v6.3-mtd-spinand-macronix-use-scratch-buffer-for-DMA-oper.patch b/target/linux/generic/backport-5.15/423-v6.3-mtd-spinand-macronix-use-scratch-buffer-for-DMA-oper.patch new file mode 100644 index 0000000000..7dbc271725 --- /dev/null +++ b/target/linux/generic/backport-5.15/423-v6.3-mtd-spinand-macronix-use-scratch-buffer-for-DMA-oper.patch @@ -0,0 +1,35 @@ +From ebed787a0becb9354f0a23620a5130cccd6c730c Mon Sep 17 00:00:00 2001 +From: Daniel Golle <daniel@makrotopia.org> +Date: Thu, 19 Jan 2023 03:45:43 +0000 +Subject: [PATCH] mtd: spinand: macronix: use scratch buffer for DMA operation + +The mx35lf1ge4ab_get_eccsr() function uses an SPI DMA operation to +read the eccsr, hence the buffer should not be on stack. Since commit +380583227c0c7f ("spi: spi-mem: Add extra sanity checks on the op param") +the kernel emmits a warning and blocks such operations. + +Use the scratch buffer to get eccsr instead of trying to directly read +into a stack-allocated variable. + +Signed-off-by: Daniel Golle <daniel@makrotopia.org> +Reviewed-by: Dhruva Gole <d-gole@ti.com> +Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> +Link: https://lore.kernel.org/linux-mtd/Y8i85zM0u4XdM46z@makrotopia.org +--- + drivers/mtd/nand/spi/macronix.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/mtd/nand/spi/macronix.c ++++ b/drivers/mtd/nand/spi/macronix.c +@@ -83,9 +83,10 @@ static int mx35lf1ge4ab_ecc_get_status(s + * in order to avoid forcing the wear-leveling layer to move + * data around if it's not necessary. + */ +- if (mx35lf1ge4ab_get_eccsr(spinand, &eccsr)) ++ if (mx35lf1ge4ab_get_eccsr(spinand, spinand->scratchbuf)) + return nanddev_get_ecc_conf(nand)->strength; + ++ eccsr = *spinand->scratchbuf; + if (WARN_ON(eccsr > nanddev_get_ecc_conf(nand)->strength || + !eccsr)) + return nanddev_get_ecc_conf(nand)->strength; |