diff options
author | Andre Heider <a.heider@gmail.com> | 2021-12-15 11:38:20 +0100 |
---|---|---|
committer | David Bauer <mail@david-bauer.net> | 2022-12-07 12:30:10 +0100 |
commit | 4e2d5f4f9f136d52ba76185df897e14586a2af83 (patch) | |
tree | 7171cfbbed693d4e0723180c6ba62751159269cc /package/utils | |
parent | f1f3d19387ffd8910669750ad2f61f6e0dd94fd4 (diff) | |
download | upstream-4e2d5f4f9f136d52ba76185df897e14586a2af83.tar.gz upstream-4e2d5f4f9f136d52ba76185df897e14586a2af83.tar.bz2 upstream-4e2d5f4f9f136d52ba76185df897e14586a2af83.zip |
fritz-tools: fritz_tffs_nand: exclude oob code when disabled
Skip unnecessary stuff if checking the oob data is disabled.
Signed-off-by: Andre Heider <a.heider@gmail.com>
Diffstat (limited to 'package/utils')
-rw-r--r-- | package/utils/fritz-tools/src/fritz_tffs_nand_read.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/package/utils/fritz-tools/src/fritz_tffs_nand_read.c b/package/utils/fritz-tools/src/fritz_tffs_nand_read.c index 22b27336f8..32f3cdf693 100644 --- a/package/utils/fritz-tools/src/fritz_tffs_nand_read.c +++ b/package/utils/fritz-tools/src/fritz_tffs_nand_read.c @@ -186,15 +186,18 @@ static int find_entry(uint32_t id, struct tffs_entry *entry) fprintf(stderr, "ERROR: sector isn't readable, but has been previously!\n"); exit(EXIT_FAILURE); } - uint32_t oob_id = read_uint32(oobbuf, 0x02); - uint32_t oob_len = read_uint32(oobbuf, 0x06); - uint32_t oob_rev = read_uint32(oobbuf, 0x0a); uint32_t read_id = read_uint32(readbuf, 0x00); uint32_t read_len = read_uint32(readbuf, 0x04); uint32_t read_rev = read_uint32(readbuf, 0x0c); - if (read_oob_sector_health && (oob_id != read_id || oob_len != read_len || oob_rev != read_rev)) { - fprintf(stderr, "Warning: sector has inconsistent metadata\n"); - continue; + if (read_oob_sector_health) { + uint32_t oob_id = read_uint32(oobbuf, 0x02); + uint32_t oob_len = read_uint32(oobbuf, 0x06); + uint32_t oob_rev = read_uint32(oobbuf, 0x0a); + + if (oob_id != read_id || oob_len != read_len || oob_rev != read_rev) { + fprintf(stderr, "Warning: sector has inconsistent metadata\n"); + continue; + } } if (read_id == TFFS_ID_END) { /* no more entries in this block */ |