aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/tests/mtd_readtest.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/tests/mtd_readtest.c')
-rw-r--r--drivers/mtd/tests/mtd_readtest.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/mtd/tests/mtd_readtest.c b/drivers/mtd/tests/mtd_readtest.c
index afe71aa15c4b..550fe51225a7 100644
--- a/drivers/mtd/tests/mtd_readtest.c
+++ b/drivers/mtd/tests/mtd_readtest.c
@@ -29,7 +29,7 @@
29 29
30#define PRINT_PREF KERN_INFO "mtd_readtest: " 30#define PRINT_PREF KERN_INFO "mtd_readtest: "
31 31
32static int dev; 32static int dev = -EINVAL;
33module_param(dev, int, S_IRUGO); 33module_param(dev, int, S_IRUGO);
34MODULE_PARM_DESC(dev, "MTD device number to use"); 34MODULE_PARM_DESC(dev, "MTD device number to use");
35 35
@@ -66,7 +66,7 @@ static int read_eraseblock_by_page(int ebnum)
66 if (mtd->oobsize) { 66 if (mtd->oobsize) {
67 struct mtd_oob_ops ops; 67 struct mtd_oob_ops ops;
68 68
69 ops.mode = MTD_OOB_PLACE; 69 ops.mode = MTD_OPS_PLACE_OOB;
70 ops.len = 0; 70 ops.len = 0;
71 ops.retlen = 0; 71 ops.retlen = 0;
72 ops.ooblen = mtd->oobsize; 72 ops.ooblen = mtd->oobsize;
@@ -75,7 +75,8 @@ static int read_eraseblock_by_page(int ebnum)
75 ops.datbuf = NULL; 75 ops.datbuf = NULL;
76 ops.oobbuf = oobbuf; 76 ops.oobbuf = oobbuf;
77 ret = mtd->read_oob(mtd, addr, &ops); 77 ret = mtd->read_oob(mtd, addr, &ops);
78 if (ret || ops.oobretlen != mtd->oobsize) { 78 if ((ret && !mtd_is_bitflip(ret)) ||
79 ops.oobretlen != mtd->oobsize) {
79 printk(PRINT_PREF "error: read oob failed at " 80 printk(PRINT_PREF "error: read oob failed at "
80 "%#llx\n", (long long)addr); 81 "%#llx\n", (long long)addr);
81 if (!err) 82 if (!err)
@@ -169,6 +170,12 @@ static int __init mtd_readtest_init(void)
169 170
170 printk(KERN_INFO "\n"); 171 printk(KERN_INFO "\n");
171 printk(KERN_INFO "=================================================\n"); 172 printk(KERN_INFO "=================================================\n");
173
174 if (dev < 0) {
175 printk(PRINT_PREF "Please specify a valid mtd-device via module paramter\n");
176 return -EINVAL;
177 }
178
172 printk(PRINT_PREF "MTD device: %d\n", dev); 179 printk(PRINT_PREF "MTD device: %d\n", dev);
173 180
174 mtd = get_mtd_device(NULL, dev); 181 mtd = get_mtd_device(NULL, dev);