mtd: tests: return -1 if verify failed
authorRoel Kluin <roel.kluin@gmail.com>
Tue, 13 Jul 2010 10:24:31 +0000 (13:24 +0300)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Mon, 2 Aug 2010 08:06:20 +0000 (09:06 +0100)
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/mtd/tests/mtd_pagetest.c

index 6bc1b8276c6270353a97a726ec3b999cfe9d7cbf..00b937e38c1d509abcda5cbd6cfc429c06b0807b 100644 (file)
@@ -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;
 }