aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/tests/mtd_oobtest.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/tests/mtd_oobtest.c')
-rw-r--r--drivers/mtd/tests/mtd_oobtest.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/drivers/mtd/tests/mtd_oobtest.c b/drivers/mtd/tests/mtd_oobtest.c
index 5553cd4eab20..dec92ae6111a 100644
--- a/drivers/mtd/tests/mtd_oobtest.c
+++ b/drivers/mtd/tests/mtd_oobtest.c
@@ -25,6 +25,7 @@
25#include <linux/moduleparam.h> 25#include <linux/moduleparam.h>
26#include <linux/err.h> 26#include <linux/err.h>
27#include <linux/mtd/mtd.h> 27#include <linux/mtd/mtd.h>
28#include <linux/slab.h>
28#include <linux/sched.h> 29#include <linux/sched.h>
29 30
30#define PRINT_PREF KERN_INFO "mtd_oobtest: " 31#define PRINT_PREF KERN_INFO "mtd_oobtest: "
@@ -343,7 +344,6 @@ static int scan_for_bad_eraseblocks(void)
343 printk(PRINT_PREF "error: cannot allocate memory\n"); 344 printk(PRINT_PREF "error: cannot allocate memory\n");
344 return -ENOMEM; 345 return -ENOMEM;
345 } 346 }
346 memset(bbt, 0 , ebcnt);
347 347
348 printk(PRINT_PREF "scanning for bad eraseblocks\n"); 348 printk(PRINT_PREF "scanning for bad eraseblocks\n");
349 for (i = 0; i < ebcnt; ++i) { 349 for (i = 0; i < ebcnt; ++i) {
@@ -392,7 +392,6 @@ static int __init mtd_oobtest_init(void)
392 mtd->writesize, ebcnt, pgcnt, mtd->oobsize); 392 mtd->writesize, ebcnt, pgcnt, mtd->oobsize);
393 393
394 err = -ENOMEM; 394 err = -ENOMEM;
395 mtd->erasesize = mtd->erasesize;
396 readbuf = kmalloc(mtd->erasesize, GFP_KERNEL); 395 readbuf = kmalloc(mtd->erasesize, GFP_KERNEL);
397 if (!readbuf) { 396 if (!readbuf) {
398 printk(PRINT_PREF "error: cannot allocate memory\n"); 397 printk(PRINT_PREF "error: cannot allocate memory\n");
@@ -476,18 +475,10 @@ static int __init mtd_oobtest_init(void)
476 use_len_max = mtd->ecclayout->oobavail; 475 use_len_max = mtd->ecclayout->oobavail;
477 vary_offset = 1; 476 vary_offset = 1;
478 simple_srand(5); 477 simple_srand(5);
479 printk(PRINT_PREF "writing OOBs of whole device\n"); 478
480 for (i = 0; i < ebcnt; ++i) { 479 err = write_whole_device();
481 if (bbt[i]) 480 if (err)
482 continue; 481 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 482
492 /* Check all eraseblocks */ 483 /* Check all eraseblocks */
493 use_offset = 0; 484 use_offset = 0;