diff options
author | Stefan Riedmueller <s.riedmueller@phytec.de> | 2021-03-30 08:50:38 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2021-04-01 10:24:14 +0200 |
commit | 60d0fbde61ee5a19eb443a057027a004d07a3a29 (patch) | |
tree | dc7088f5d269d3a86bf94580f1884aec35c2cd81 /commands | |
parent | 67006d577c80e48cbb39c534ac431117abd5f21d (diff) | |
download | barebox-60d0fbde61ee5a19eb443a057027a004d07a3a29.tar.gz barebox-60d0fbde61ee5a19eb443a057027a004d07a3a29.tar.xz |
nandtest: Fix status print for NAND which size exceeds 4 GB
Nandsize can be larger than 4 GB. So during status print the number of
blocks calculation needs to use 64 bit division.
Signed-off-by: Stefan Riedmueller <s.riedmueller@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands')
-rw-r--r-- | commands/nandtest.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/commands/nandtest.c b/commands/nandtest.c index bfe4c4c0ed..1bb59c7fdb 100644 --- a/commands/nandtest.c +++ b/commands/nandtest.c @@ -178,12 +178,14 @@ static int erase_and_write(loff_t ofs, unsigned char *data, } /* Print stats of nandtest. */ -static void print_stats(int nr_passes, int length) +static void print_stats(int nr_passes, loff_t length) { unsigned int i; + uint64_t blocks = (uint64_t)length; + + do_div(blocks, meminfo.erasesize); printf("-------- Summary --------\n"); - printf("Tested blocks : %d\n", (length/meminfo.erasesize) - * nr_passes); + printf("Tested blocks : %lld\n", blocks * nr_passes); for (i = 0; i < MAX_ECC_BITS; i++) printf("ECC %d bit error(s) : %u\n", i + 1, ecc_stats[i]); |