diff options
| author | Rafał Miłecki <[email protected]> | 2026-02-21 11:00:09 +0100 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2026-03-06 10:32:41 -0600 |
| commit | 1d175b2108d7e0aa74a182ac1ebde58a4f129371 (patch) | |
| tree | d31b7ea2b2d1db9fd3913b0426508b8de046b3f9 | |
| parent | 2f28f4116a173891f5c88e1ae3de374241bb1121 (diff) | |
fw_env: unify calculation of "blockstart" in flash_write_buf()
In both code paths "blockstart" is calculated the same way. Unify it.
Signed-off-by: Rafał Miłecki <[email protected]>
Reviewed-by: Tom Rini <[email protected]>
| -rw-r--r-- | tools/env/fw_env.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c index c369bda1b85..8ca6a3e5478 100644 --- a/tools/env/fw_env.c +++ b/tools/env/fw_env.c @@ -1007,7 +1007,6 @@ static int flash_write_buf(int dev, int fd, void *buf, size_t count) if (DEVTYPE(dev) == MTD_ABSENT) { blocklen = count; erase_len = blocklen; - blockstart = DEVOFFSET(dev); block_seek = 0; write_total = blocklen; } else { @@ -1018,8 +1017,6 @@ static int flash_write_buf(int dev, int fd, void *buf, size_t count) /* Maximum area we may use */ erase_len = environment_end(dev) - erase_offset; - blockstart = erase_offset; - /* Offset inside a block */ block_seek = DEVOFFSET(dev) - erase_offset; @@ -1085,6 +1082,7 @@ static int flash_write_buf(int dev, int fd, void *buf, size_t count) erase.length = erasesize; /* This only runs once on NOR flash and SPI-dataflash */ + blockstart = DEVOFFSET(dev); while (processed < write_total) { rc = flash_bad_block(fd, DEVTYPE(dev), blockstart); if (rc < 0) /* block test failed */ |
