mtd: tests: abort torturetest on erase errors
authorBrian Norris <computersforpeace@gmail.com>
Fri, 21 Nov 2014 18:24:29 +0000 (10:24 -0800)
committerBrian Norris <computersforpeace@gmail.com>
Sat, 13 Dec 2014 03:28:43 +0000 (19:28 -0800)
The torture test should quit once it actually induces an error in the
flash. This step was accidentally removed during refactoring.

Without this fix, the torturetest just continues infinitely, or until
the maximum cycle count is reached. e.g.:

   ...
   [ 7619.218171] mtd_test: error -5 while erasing EB 100
   [ 7619.297981] mtd_test: error -5 while erasing EB 100
   [ 7619.377953] mtd_test: error -5 while erasing EB 100
   [ 7619.457998] mtd_test: error -5 while erasing EB 100
   [ 7619.537990] mtd_test: error -5 while erasing EB 100
   ...

Fixes: 6cf78358c94f ("mtd: mtd_torturetest: use mtd_test helpers")
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Cc: Akinobu Mita <akinobu.mita@gmail.com>
Cc: <stable@vger.kernel.org>
drivers/mtd/tests/torturetest.c

index eeab96973cf07e6dcab864c5ee4e23eff0f0a32c..b55bc52a134084759b5dd61d22554faa1f0bc032 100644 (file)
@@ -264,7 +264,9 @@ static int __init tort_init(void)
                int i;
                void *patt;
 
-               mtdtest_erase_good_eraseblocks(mtd, bad_ebs, eb, ebcnt);
+               err = mtdtest_erase_good_eraseblocks(mtd, bad_ebs, eb, ebcnt);
+               if (err)
+                       goto out;
 
                /* Check if the eraseblocks contain only 0xFF bytes */
                if (check) {