Skip to content

Commit ebed787

Browse files
dangowrtmiquelraynal
authored andcommitted
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 3805832 ("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
1 parent 43651e6 commit ebed787

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/mtd/nand/spi/macronix.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,10 @@ static int mx35lf1ge4ab_ecc_get_status(struct spinand_device *spinand,
8383
* in order to avoid forcing the wear-leveling layer to move
8484
* data around if it's not necessary.
8585
*/
86-
if (mx35lf1ge4ab_get_eccsr(spinand, &eccsr))
86+
if (mx35lf1ge4ab_get_eccsr(spinand, spinand->scratchbuf))
8787
return nanddev_get_ecc_conf(nand)->strength;
8888

89+
eccsr = *spinand->scratchbuf;
8990
if (WARN_ON(eccsr > nanddev_get_ecc_conf(nand)->strength ||
9091
!eccsr))
9192
return nanddev_get_ecc_conf(nand)->strength;

0 commit comments

Comments
 (0)