mtd: tests: return -1 if verify failed

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Wed Aug 4 06:59:04 EDT 2010


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=7fc14bcee0fc0fe1b7e1bd78d4fc0da395ebef35
Commit:     7fc14bcee0fc0fe1b7e1bd78d4fc0da395ebef35
Parent:     ece0ac98a13a555e6d46a02225fa15934abe7a3d
Author:     Roel Kluin <roel.kluin at gmail.com>
AuthorDate: Tue Jul 13 13:24:31 2010 +0300
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Mon Aug 2 09:06:20 2010 +0100

    mtd: tests: return -1 if verify failed
    
    Signed-off-by: Roel Kluin <roel.kluin at gmail.com>
    Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/tests/mtd_pagetest.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/mtd/tests/mtd_pagetest.c b/drivers/mtd/tests/mtd_pagetest.c
index 6bc1b82..00b937e 100644
--- a/drivers/mtd/tests/mtd_pagetest.c
+++ b/drivers/mtd/tests/mtd_pagetest.c
@@ -310,7 +310,7 @@ static int crosstest(void)
 static int erasecrosstest(void)
 {
 	size_t read = 0, written = 0;
-	int err = 0, i, ebnum, ok = 1, ebnum2;
+	int err = 0, i, ebnum, ebnum2;
 	loff_t addr0;
 	char *readbuf = twopages;
 
@@ -357,8 +357,7 @@ static int erasecrosstest(void)
 	if (memcmp(writebuf, readbuf, pgsize)) {
 		printk(PRINT_PREF "verify failed!\n");
 		errcnt += 1;
-		ok = 0;
-		return err;
+		return -1;
 	}
 
 	printk(PRINT_PREF "erasing block %d\n", ebnum);
@@ -396,10 +395,10 @@ static int erasecrosstest(void)
 	if (memcmp(writebuf, readbuf, pgsize)) {
 		printk(PRINT_PREF "verify failed!\n");
 		errcnt += 1;
-		ok = 0;
+		return -1;
 	}
 
-	if (ok && !err)
+	if (!err)
 		printk(PRINT_PREF "erasecrosstest ok\n");
 	return err;
 }



More information about the linux-mtd-cvs mailing list