Skip to content

Commit 8544cda

Browse files
maignialoliviermiquelraynal
authored andcommitted
mtd: spinand: toshiba: Fix ecc_get_status
Reading ECC status is failing. tx58cxgxsxraix_ecc_get_status() is using on-stack buffer for SPINAND_GET_FEATURE_OP() output. It is not suitable for DMA needs of spi-mem. Fix this by using the spi-mem operations dedicated buffer spinand->scratchbuf. See spinand->scratchbuf: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/mtd/spinand.h?h=v6.3#n418 spi_mem_check_op(): https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/spi/spi-mem.c?h=v6.3#n199 Fixes: 10949af ("mtd: spinand: Add initial support for Toshiba TC58CVG2S0H") Cc: stable@vger.kernel.org Signed-off-by: Olivier Maignial <olivier.maignial@hotmail.fr> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/DB4P250MB1032553D05FBE36DEE0D311EFE23A@DB4P250MB1032.EURP250.PROD.OUTLOOK.COM
1 parent 06c2afb commit 8544cda

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/mtd/nand/spi/toshiba.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ static int tx58cxgxsxraix_ecc_get_status(struct spinand_device *spinand,
7373
{
7474
struct nand_device *nand = spinand_to_nand(spinand);
7575
u8 mbf = 0;
76-
struct spi_mem_op op = SPINAND_GET_FEATURE_OP(0x30, &mbf);
76+
struct spi_mem_op op = SPINAND_GET_FEATURE_OP(0x30, spinand->scratchbuf);
7777

7878
switch (status & STATUS_ECC_MASK) {
7979
case STATUS_ECC_NO_BITFLIPS:
@@ -92,7 +92,7 @@ static int tx58cxgxsxraix_ecc_get_status(struct spinand_device *spinand,
9292
if (spi_mem_exec_op(spinand->spimem, &op))
9393
return nanddev_get_ecc_conf(nand)->strength;
9494

95-
mbf >>= 4;
95+
mbf = *(spinand->scratchbuf) >> 4;
9696

9797
if (WARN_ON(mbf > nanddev_get_ecc_conf(nand)->strength || !mbf))
9898
return nanddev_get_ecc_conf(nand)->strength;

0 commit comments

Comments
 (0)