diff options
Diffstat (limited to 'drivers/mtd/tests/mtd_speedtest.c')
-rw-r--r-- | drivers/mtd/tests/mtd_speedtest.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/mtd/tests/mtd_speedtest.c b/drivers/mtd/tests/mtd_speedtest.c index 627d4e2466a..493b367bdd3 100644 --- a/drivers/mtd/tests/mtd_speedtest.c +++ b/drivers/mtd/tests/mtd_speedtest.c | |||
@@ -29,7 +29,7 @@ | |||
29 | 29 | ||
30 | #define PRINT_PREF KERN_INFO "mtd_speedtest: " | 30 | #define PRINT_PREF KERN_INFO "mtd_speedtest: " |
31 | 31 | ||
32 | static int dev; | 32 | static int dev = -EINVAL; |
33 | module_param(dev, int, S_IRUGO); | 33 | module_param(dev, int, S_IRUGO); |
34 | MODULE_PARM_DESC(dev, "MTD device number to use"); | 34 | MODULE_PARM_DESC(dev, "MTD device number to use"); |
35 | 35 | ||
@@ -216,7 +216,7 @@ static int read_eraseblock(int ebnum) | |||
216 | 216 | ||
217 | err = mtd->read(mtd, addr, mtd->erasesize, &read, iobuf); | 217 | err = mtd->read(mtd, addr, mtd->erasesize, &read, iobuf); |
218 | /* Ignore corrected ECC errors */ | 218 | /* Ignore corrected ECC errors */ |
219 | if (err == -EUCLEAN) | 219 | if (mtd_is_bitflip(err)) |
220 | err = 0; | 220 | err = 0; |
221 | if (err || read != mtd->erasesize) { | 221 | if (err || read != mtd->erasesize) { |
222 | printk(PRINT_PREF "error: read failed at %#llx\n", addr); | 222 | printk(PRINT_PREF "error: read failed at %#llx\n", addr); |
@@ -237,7 +237,7 @@ static int read_eraseblock_by_page(int ebnum) | |||
237 | for (i = 0; i < pgcnt; i++) { | 237 | for (i = 0; i < pgcnt; i++) { |
238 | err = mtd->read(mtd, addr, pgsize, &read, buf); | 238 | err = mtd->read(mtd, addr, pgsize, &read, buf); |
239 | /* Ignore corrected ECC errors */ | 239 | /* Ignore corrected ECC errors */ |
240 | if (err == -EUCLEAN) | 240 | if (mtd_is_bitflip(err)) |
241 | err = 0; | 241 | err = 0; |
242 | if (err || read != pgsize) { | 242 | if (err || read != pgsize) { |
243 | printk(PRINT_PREF "error: read failed at %#llx\n", | 243 | printk(PRINT_PREF "error: read failed at %#llx\n", |
@@ -263,7 +263,7 @@ static int read_eraseblock_by_2pages(int ebnum) | |||
263 | for (i = 0; i < n; i++) { | 263 | for (i = 0; i < n; i++) { |
264 | err = mtd->read(mtd, addr, sz, &read, buf); | 264 | err = mtd->read(mtd, addr, sz, &read, buf); |
265 | /* Ignore corrected ECC errors */ | 265 | /* Ignore corrected ECC errors */ |
266 | if (err == -EUCLEAN) | 266 | if (mtd_is_bitflip(err)) |
267 | err = 0; | 267 | err = 0; |
268 | if (err || read != sz) { | 268 | if (err || read != sz) { |
269 | printk(PRINT_PREF "error: read failed at %#llx\n", | 269 | printk(PRINT_PREF "error: read failed at %#llx\n", |
@@ -278,7 +278,7 @@ static int read_eraseblock_by_2pages(int ebnum) | |||
278 | if (pgcnt % 2) { | 278 | if (pgcnt % 2) { |
279 | err = mtd->read(mtd, addr, pgsize, &read, buf); | 279 | err = mtd->read(mtd, addr, pgsize, &read, buf); |
280 | /* Ignore corrected ECC errors */ | 280 | /* Ignore corrected ECC errors */ |
281 | if (err == -EUCLEAN) | 281 | if (mtd_is_bitflip(err)) |
282 | err = 0; | 282 | err = 0; |
283 | if (err || read != pgsize) { | 283 | if (err || read != pgsize) { |
284 | printk(PRINT_PREF "error: read failed at %#llx\n", | 284 | printk(PRINT_PREF "error: read failed at %#llx\n", |
@@ -361,6 +361,13 @@ static int __init mtd_speedtest_init(void) | |||
361 | 361 | ||
362 | printk(KERN_INFO "\n"); | 362 | printk(KERN_INFO "\n"); |
363 | printk(KERN_INFO "=================================================\n"); | 363 | printk(KERN_INFO "=================================================\n"); |
364 | |||
365 | if (dev < 0) { | ||
366 | printk(PRINT_PREF "Please specify a valid mtd-device via module paramter\n"); | ||
367 | printk(KERN_CRIT "CAREFUL: This test wipes all data on the specified MTD device!\n"); | ||
368 | return -EINVAL; | ||
369 | } | ||
370 | |||
364 | if (count) | 371 | if (count) |
365 | printk(PRINT_PREF "MTD device: %d count: %d\n", dev, count); | 372 | printk(PRINT_PREF "MTD device: %d count: %d\n", dev, count); |
366 | else | 373 | else |