diff options
author | Andreas Fenkart <andreas.fenkart@digitalstrom.com> | 2016-08-29 23:16:58 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2016-10-06 20:57:34 -0400 |
commit | c6012bbce6ce9ac3162aeb841b2502ba71e52af6 (patch) | |
tree | 4dfc6424e94c8beb6b8fc1c4823a3be1a7a87005 /tools | |
parent | e2c9351d5ac140a365655967920a72f57357ae27 (diff) |
tools/env: pass bad block offset by value
the offset is not modified by linux ioctl call
see mtd_ioctl{drivers/mtd/mtdchar.c}
Makes the interface less ambiguous, since the caller can
now exclude a modification of blockstart
Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/env/fw_env.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c index 90eb5fa4cb..86849b76a9 100644 --- a/tools/env/fw_env.c +++ b/tools/env/fw_env.c @@ -661,10 +661,10 @@ off_t environment_end(int dev) * > 0 - block is bad * < 0 - failed to test */ -static int flash_bad_block (int fd, uint8_t mtd_type, loff_t *blockstart) +static int flash_bad_block(int fd, uint8_t mtd_type, loff_t blockstart) { if (mtd_type == MTD_NANDFLASH) { - int badblock = ioctl (fd, MEMGETBADBLOCK, blockstart); + int badblock = ioctl(fd, MEMGETBADBLOCK, &blockstart); if (badblock < 0) { perror ("Cannot read bad block mark"); @@ -674,7 +674,7 @@ static int flash_bad_block (int fd, uint8_t mtd_type, loff_t *blockstart) if (badblock) { #ifdef DEBUG fprintf (stderr, "Bad block at 0x%llx, skipping\n", - (unsigned long long) *blockstart); + (unsigned long long)blockstart); #endif return badblock; } @@ -722,7 +722,7 @@ static int flash_read_buf (int dev, int fd, void *buf, size_t count, /* This only runs once on NOR flash */ while (processed < count) { - rc = flash_bad_block (fd, mtd_type, &blockstart); + rc = flash_bad_block(fd, mtd_type, blockstart); if (rc < 0) /* block test failed */ return -1; @@ -876,7 +876,7 @@ static int flash_write_buf (int dev, int fd, void *buf, size_t count, /* This only runs once on NOR flash and SPI-dataflash */ while (processed < write_total) { - rc = flash_bad_block (fd, mtd_type, &blockstart); + rc = flash_bad_block(fd, mtd_type, blockstart); if (rc < 0) /* block test failed */ return rc; |