[PATCH 1/6] fw_env: use "erasesize" variable in writing loop

Rafał Miłecki zajec5 at gmail.com
Sat Feb 21 11:00:06 CET 2026


From: Rafał Miłecki <rafal at milecki.pl>

Use "erasesize" instead of "blocklen" in flash_write_buf()'s loop. This
change touches code executed for bad NAND blocks so it doesn't affect
any behaviour (for NAND flashes "blocklen" and "erasesize" are equal).

This just makes code a bit more consistent as "erasesize" is what is
used all around inside the writing loop.

Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
---
 tools/env/fw_env.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
index 425faf380fb..c69da0b926a 100644
--- a/tools/env/fw_env.c
+++ b/tools/env/fw_env.c
@@ -1096,7 +1096,7 @@ static int flash_write_buf(int dev, int fd, void *buf, size_t count)
 		}
 
 		if (rc) {	/* block is bad */
-			blockstart += blocklen;
+			blockstart += erasesize;
 			continue;
 		}
 
-- 
2.51.0



More information about the U-Boot mailing list