mtd: cleanup mtd_oobtest
authorAkinobu Mita <akinobu.mita@gmail.com>
Fri, 9 Oct 2009 09:43:52 +0000 (18:43 +0900)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Sat, 17 Oct 2009 14:39:48 +0000 (15:39 +0100)
- Remove unnecessary memset for bbt
  All entries will be initialized at a few lines below
- Remove unnecessary initialization for mtd->erasesize
- Use write_whole_device()

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/mtd/tests/mtd_oobtest.c

index 5553cd4eab2083d80824f49e95423e1e2507a705..5813920e79a5f346278247de54990a03062e91c8 100644 (file)
@@ -343,7 +343,6 @@ static int scan_for_bad_eraseblocks(void)
                printk(PRINT_PREF "error: cannot allocate memory\n");
                return -ENOMEM;
        }
-       memset(bbt, 0 , ebcnt);
 
        printk(PRINT_PREF "scanning for bad eraseblocks\n");
        for (i = 0; i < ebcnt; ++i) {
@@ -392,7 +391,6 @@ static int __init mtd_oobtest_init(void)
               mtd->writesize, ebcnt, pgcnt, mtd->oobsize);
 
        err = -ENOMEM;
-       mtd->erasesize = mtd->erasesize;
        readbuf = kmalloc(mtd->erasesize, GFP_KERNEL);
        if (!readbuf) {
                printk(PRINT_PREF "error: cannot allocate memory\n");
@@ -476,18 +474,10 @@ static int __init mtd_oobtest_init(void)
        use_len_max = mtd->ecclayout->oobavail;
        vary_offset = 1;
        simple_srand(5);
-       printk(PRINT_PREF "writing OOBs of whole device\n");
-       for (i = 0; i < ebcnt; ++i) {
-               if (bbt[i])
-                       continue;
-               err = write_eraseblock(i);
-               if (err)
-                       goto out;
-               if (i % 256 == 0)
-                       printk(PRINT_PREF "written up to eraseblock %u\n", i);
-               cond_resched();
-       }
-       printk(PRINT_PREF "written %u eraseblocks\n", i);
+
+       err = write_whole_device();
+       if (err)
+               goto out;
 
        /* Check all eraseblocks */
        use_offset = 0;