diff mbox series

mtd: nand: pxa3xx: fix raw read when last_chunk_size == 0

Message ID f5edc33388dac2f3877cab86426a2750f0e9ce16.1586103571.git.baruch@tkos.co.il
State Accepted
Commit 593f3976bee1213ac8d3d124c59aefc8889edc8b
Headers show
Series mtd: nand: pxa3xx: fix raw read when last_chunk_size == 0 | expand

Commit Message

Baruch Siach April 5, 2020, 4:19 p.m. UTC
Commit 6293b0361d9 ("mtd: nand: pxa3xx: add raw read support") added the
local data_len variable in handle_data_pio() to track read size, but
forgot to update the condition of drain_fifo() call. That happens to
work when the layout last_chunk_size != 0. But when last_chunk_size ==
0, drain_fifo() is not called to read the last chunk, which leads to
"Wait timeout!!!" error. Fix this.

Fixes: 6293b0361d9 ("mtd: nand: pxa3xx: add raw read support")
Cc: Miquel Raynal <miquel.raynal at bootlin.com>
Signed-off-by: Baruch Siach <baruch at tkos.co.il>
---
 drivers/mtd/nand/raw/pxa3xx_nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tom Rini April 26, 2020, 11:26 a.m. UTC | #1
On Sun, Apr 05, 2020 at 07:19:31PM +0300, Baruch Siach wrote:

> Commit 6293b0361d9 ("mtd: nand: pxa3xx: add raw read support") added the
> local data_len variable in handle_data_pio() to track read size, but
> forgot to update the condition of drain_fifo() call. That happens to
> work when the layout last_chunk_size != 0. But when last_chunk_size ==
> 0, drain_fifo() is not called to read the last chunk, which leads to
> "Wait timeout!!!" error. Fix this.
> 
> Fixes: 6293b0361d9 ("mtd: nand: pxa3xx: add raw read support")
> Cc: Miquel Raynal <miquel.raynal at bootlin.com>
> Signed-off-by: Baruch Siach <baruch at tkos.co.il>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/drivers/mtd/nand/raw/pxa3xx_nand.c b/drivers/mtd/nand/raw/pxa3xx_nand.c
index 03f210bdb0b3..7e3346dfcc2d 100644
--- a/drivers/mtd/nand/raw/pxa3xx_nand.c
+++ b/drivers/mtd/nand/raw/pxa3xx_nand.c
@@ -639,7 +639,7 @@  static void handle_data_pio(struct pxa3xx_nand_info *info)
 				DIV_ROUND_UP(info->step_spare_size, 4));
 		break;
 	case STATE_PIO_READING:
-		if (info->step_chunk_size)
+		if (data_len)
 			drain_fifo(info,
 				   info->data_buff + info->data_buff_pos,
 				   DIV_ROUND_UP(data_len, 4));