aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/tests/mtd_subpagetest.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/tests/mtd_subpagetest.c')
-rw-r--r--drivers/mtd/tests/mtd_subpagetest.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/mtd/tests/mtd_subpagetest.c b/drivers/mtd/tests/mtd_subpagetest.c
index 334eae53a3db..1a05bfac4eee 100644
--- a/drivers/mtd/tests/mtd_subpagetest.c
+++ b/drivers/mtd/tests/mtd_subpagetest.c
@@ -29,7 +29,7 @@
29 29
30#define PRINT_PREF KERN_INFO "mtd_subpagetest: " 30#define PRINT_PREF KERN_INFO "mtd_subpagetest: "
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
@@ -198,7 +198,7 @@ static int verify_eraseblock(int ebnum)
198 read = 0; 198 read = 0;
199 err = mtd->read(mtd, addr, subpgsize, &read, readbuf); 199 err = mtd->read(mtd, addr, subpgsize, &read, readbuf);
200 if (unlikely(err || read != subpgsize)) { 200 if (unlikely(err || read != subpgsize)) {
201 if (err == -EUCLEAN && read == subpgsize) { 201 if (mtd_is_bitflip(err) && read == subpgsize) {
202 printk(PRINT_PREF "ECC correction at %#llx\n", 202 printk(PRINT_PREF "ECC correction at %#llx\n",
203 (long long)addr); 203 (long long)addr);
204 err = 0; 204 err = 0;
@@ -226,7 +226,7 @@ static int verify_eraseblock(int ebnum)
226 read = 0; 226 read = 0;
227 err = mtd->read(mtd, addr, subpgsize, &read, readbuf); 227 err = mtd->read(mtd, addr, subpgsize, &read, readbuf);
228 if (unlikely(err || read != subpgsize)) { 228 if (unlikely(err || read != subpgsize)) {
229 if (err == -EUCLEAN && read == subpgsize) { 229 if (mtd_is_bitflip(err) && read == subpgsize) {
230 printk(PRINT_PREF "ECC correction at %#llx\n", 230 printk(PRINT_PREF "ECC correction at %#llx\n",
231 (long long)addr); 231 (long long)addr);
232 err = 0; 232 err = 0;
@@ -264,7 +264,7 @@ static int verify_eraseblock2(int ebnum)
264 read = 0; 264 read = 0;
265 err = mtd->read(mtd, addr, subpgsize * k, &read, readbuf); 265 err = mtd->read(mtd, addr, subpgsize * k, &read, readbuf);
266 if (unlikely(err || read != subpgsize * k)) { 266 if (unlikely(err || read != subpgsize * k)) {
267 if (err == -EUCLEAN && read == subpgsize * k) { 267 if (mtd_is_bitflip(err) && read == subpgsize * k) {
268 printk(PRINT_PREF "ECC correction at %#llx\n", 268 printk(PRINT_PREF "ECC correction at %#llx\n",
269 (long long)addr); 269 (long long)addr);
270 err = 0; 270 err = 0;
@@ -298,7 +298,7 @@ static int verify_eraseblock_ff(int ebnum)
298 read = 0; 298 read = 0;
299 err = mtd->read(mtd, addr, subpgsize, &read, readbuf); 299 err = mtd->read(mtd, addr, subpgsize, &read, readbuf);
300 if (unlikely(err || read != subpgsize)) { 300 if (unlikely(err || read != subpgsize)) {
301 if (err == -EUCLEAN && read == subpgsize) { 301 if (mtd_is_bitflip(err) && read == subpgsize) {
302 printk(PRINT_PREF "ECC correction at %#llx\n", 302 printk(PRINT_PREF "ECC correction at %#llx\n",
303 (long long)addr); 303 (long long)addr);
304 err = 0; 304 err = 0;
@@ -379,6 +379,13 @@ static int __init mtd_subpagetest_init(void)
379 379
380 printk(KERN_INFO "\n"); 380 printk(KERN_INFO "\n");
381 printk(KERN_INFO "=================================================\n"); 381 printk(KERN_INFO "=================================================\n");
382
383 if (dev < 0) {
384 printk(PRINT_PREF "Please specify a valid mtd-device via module paramter\n");
385 printk(KERN_CRIT "CAREFUL: This test wipes all data on the specified MTD device!\n");
386 return -EINVAL;
387 }
388
382 printk(PRINT_PREF "MTD device: %d\n", dev); 389 printk(PRINT_PREF "MTD device: %d\n", dev);
383 390
384 mtd = get_mtd_device(NULL, dev); 391 mtd = get_mtd_device(NULL, dev);