Skip to content

Commit 5995061

Browse files
hanxu-nxpmiquelraynal
authored andcommitted
mtd: spinand: gigadevice: Fix the get ecc status issue
Some GigaDevice ecc_get_status functions use on-stack buffer for spi_mem_op causes spi_mem_check_op failing, fix the issue by using spinand scratchbuf. Fixes: c40c7a9 ("mtd: spinand: Add support for GigaDevice GD5F1GQ4UExxG") Signed-off-by: Han Xu <han.xu@nxp.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20231108150701.593912-1-han.xu@nxp.com
1 parent 6613476 commit 5995061

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/mtd/nand/spi/gigadevice.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ static int gd5fxgq4uexxg_ecc_get_status(struct spinand_device *spinand,
186186
{
187187
u8 status2;
188188
struct spi_mem_op op = SPINAND_GET_FEATURE_OP(GD5FXGQXXEXXG_REG_STATUS2,
189-
&status2);
189+
spinand->scratchbuf);
190190
int ret;
191191

192192
switch (status & STATUS_ECC_MASK) {
@@ -207,6 +207,7 @@ static int gd5fxgq4uexxg_ecc_get_status(struct spinand_device *spinand,
207207
* report the maximum of 4 in this case
208208
*/
209209
/* bits sorted this way (3...0): ECCS1,ECCS0,ECCSE1,ECCSE0 */
210+
status2 = *(spinand->scratchbuf);
210211
return ((status & STATUS_ECC_MASK) >> 2) |
211212
((status2 & STATUS_ECC_MASK) >> 4);
212213

@@ -228,7 +229,7 @@ static int gd5fxgq5xexxg_ecc_get_status(struct spinand_device *spinand,
228229
{
229230
u8 status2;
230231
struct spi_mem_op op = SPINAND_GET_FEATURE_OP(GD5FXGQXXEXXG_REG_STATUS2,
231-
&status2);
232+
spinand->scratchbuf);
232233
int ret;
233234

234235
switch (status & STATUS_ECC_MASK) {
@@ -248,6 +249,7 @@ static int gd5fxgq5xexxg_ecc_get_status(struct spinand_device *spinand,
248249
* 1 ... 4 bits are flipped (and corrected)
249250
*/
250251
/* bits sorted this way (1...0): ECCSE1, ECCSE0 */
252+
status2 = *(spinand->scratchbuf);
251253
return ((status2 & STATUS_ECC_MASK) >> 4) + 1;
252254

253255
case STATUS_ECC_UNCOR_ERROR:

0 commit comments

Comments
 (0)