Patchwork [v2,2/6] mtd: mtd_nandecctest: make module_init() return an error code if test fails

login
register
mail settings
Submitter Akinobu Mita
Date Aug. 26, 2012, 12:06 p.m.
Message ID <1345982808-11440-3-git-send-email-akinobu.mita@gmail.com>
Download mbox | patch
Permalink /patch/180045/
State New
Headers show

Comments

Akinobu Mita - Aug. 26, 2012, 12:06 p.m.
Return an error code if test fails in order to detect a test case failure
by invoking tests repeatedly like this:

while sudo modprobe mtd_nandecctest; do
	sudo modprobe -r mtd_nandecctest
done

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: linux-mtd@lists.infradead.org
Cc: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
---
 drivers/mtd/tests/mtd_nandecctest.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Patch

diff --git a/drivers/mtd/tests/mtd_nandecctest.c b/drivers/mtd/tests/mtd_nandecctest.c
index 4d7b171..f71ed92 100644
--- a/drivers/mtd/tests/mtd_nandecctest.c
+++ b/drivers/mtd/tests/mtd_nandecctest.c
@@ -66,10 +66,13 @@  static int nand_ecc_test(const size_t size)
 
 static int __init ecc_test_init(void)
 {
-	nand_ecc_test(256);
-	nand_ecc_test(512);
+	int err;
 
-	return 0;
+	err = nand_ecc_test(256);
+	if (err)
+		return err;
+
+	return nand_ecc_test(512);
 }
 
 static void __exit ecc_test_exit(void)