[PATCH 2/4] nandtest: Fix status print for NAND which size exceeds 4 GB

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 commands/nandtest.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/commands/nandtest.c b/commands/nandtest.c
index bfe4c4c0ed03..1bb59c7fdba5 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]);
-- 
2.25.1


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux