aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/tests
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2009-10-09 05:43:52 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2009-10-17 10:39:48 -0400
commitf54d6336372b97d3624d1c5c179b2dd062472bd1 (patch)
treeb3273e94befaa95785717498c2df0cdeda2a50ea /drivers/mtd/tests
parent5a134239e707b23c65948f41f40b828d40e440af (diff)
mtd: cleanup mtd_oobtest
- 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>
Diffstat (limited to 'drivers/mtd/tests')
-rw-r--r--drivers/mtd/tests/mtd_oobtest.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/drivers/mtd/tests/mtd_oobtest.c b/drivers/mtd/tests/mtd_oobtest.c
index 5553cd4eab20..5813920e79a5 100644
--- a/drivers/mtd/tests/mtd_oobtest.c
+++ b/drivers/mtd/tests/mtd_oobtest.c
@@ -343,7 +343,6 @@ static int scan_for_bad_eraseblocks(void)
343 printk(PRINT_PREF "error: cannot allocate memory\n"); 343 printk(PRINT_PREF "error: cannot allocate memory\n");
344 return -ENOMEM; 344 return -ENOMEM;
345 } 345 }
346 memset(bbt, 0 , ebcnt);
347 346
348 printk(PRINT_PREF "scanning for bad eraseblocks\n"); 347 printk(PRINT_PREF "scanning for bad eraseblocks\n");
349 for (i = 0; i < ebcnt; ++i) { 348 for (i = 0; i < ebcnt; ++i) {
@@ -392,7 +391,6 @@ static int __init mtd_oobtest_init(void)
392 mtd->writesize, ebcnt, pgcnt, mtd->oobsize); 391 mtd->writesize, ebcnt, pgcnt, mtd->oobsize);
393 392
394 err = -ENOMEM; 393 err = -ENOMEM;
395 mtd->erasesize = mtd->erasesize;
396 readbuf = kmalloc(mtd->erasesize, GFP_KERNEL); 394 readbuf = kmalloc(mtd->erasesize, GFP_KERNEL);
397 if (!readbuf) { 395 if (!readbuf) {
398 printk(PRINT_PREF "error: cannot allocate memory\n"); 396 printk(PRINT_PREF "error: cannot allocate memory\n");
@@ -476,18 +474,10 @@ static int __init mtd_oobtest_init(void)
476 use_len_max = mtd->ecclayout->oobavail; 474 use_len_max = mtd->ecclayout->oobavail;
477 vary_offset = 1; 475 vary_offset = 1;
478 simple_srand(5); 476 simple_srand(5);
479 printk(PRINT_PREF "writing OOBs of whole device\n"); 477
480 for (i = 0; i < ebcnt; ++i) { 478 err = write_whole_device();
481 if (bbt[i]) 479 if (err)
482 continue; 480 goto out;
483 err = write_eraseblock(i);
484 if (err)
485 goto out;
486 if (i % 256 == 0)
487 printk(PRINT_PREF "written up to eraseblock %u\n", i);
488 cond_resched();
489 }
490 printk(PRINT_PREF "written %u eraseblocks\n", i);
491 481
492 /* Check all eraseblocks */ 482 /* Check all eraseblocks */
493 use_offset = 0; 483 use_offset = 0;