[PATCH 8/8] nandtest: add another constraints check

Alexander Aring alex.aring at googlemail.com
Mon Oct 22 03:23:32 EDT 2012


Add check if writesize is a multiple of erasesize.

Signed-off-by: Alexander Aring <alex.aring at gmail.com>
---
 commands/nandtest.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/commands/nandtest.c b/commands/nandtest.c
index f9c9318..f08f8eb 100644
--- a/commands/nandtest.c
+++ b/commands/nandtest.c
@@ -282,6 +282,13 @@ static int do_nandtest(int argc, char *argv[])
 	printf("Erasesize: 0x%08x\n", meminfo.erasesize);
 	printf("Starting nandtest...\n");
 
+	if (!IS_ALIGNED(meminfo.erasesize, meminfo.writesize)) {
+		printf("Erasesize 0x%08x is not a multiple "
+				"of writesize 0x%08x.\n"
+				"Please check driver implementation\n",
+				meminfo.erasesize, meminfo.writesize);
+		goto err;
+	}
 	if (!IS_ALIGNED(flash_offset, meminfo.erasesize)) {
 		printf("Offset 0x%08llx not multiple of erase size 0x%08x\n",
 			flash_offset, meminfo.erasesize);
-- 
1.7.12.4




More information about the barebox mailing list