From: Stefan Riedmueller <s.riedmueller@phytec.de>
To: barebox@lists.infradead.org
Subject: [PATCH 2/4] nandtest: Fix status print for NAND which size exceeds 4 GB
Date: Tue, 30 Mar 2021 08:50:38 +0200 [thread overview]
Message-ID: <20210330065040.5030-2-s.riedmueller@phytec.de> (raw)
In-Reply-To: <20210330065040.5030-1-s.riedmueller@phytec.de>
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>
---
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@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2021-03-30 6:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-30 6:50 [PATCH 1/4] commands: Kconfig: Remove HW ECC dependency from nandtest Stefan Riedmueller
2021-03-30 6:50 ` Stefan Riedmueller [this message]
2021-03-30 6:50 ` [PATCH 3/4] mtd: nand_msx: Implement ooblayout ops Stefan Riedmueller
2021-03-30 6:50 ` [PATCH 4/4] imx-bbu-nand-fcb: Inform user if the barebox partition is too small Stefan Riedmueller
2021-04-01 8:26 ` [PATCH 1/4] commands: Kconfig: Remove HW ECC dependency from nandtest Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210330065040.5030-2-s.riedmueller@phytec.de \
--to=s.riedmueller@phytec.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox