mtd: mtd_nandecctest: make module_init() return an error code if test fails

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Sat Sep 29 10:59:11 EDT 2012


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=f45c2990dc3de65d22e5f3b2f6b5df60a102e493
Commit:     f45c2990dc3de65d22e5f3b2f6b5df60a102e493
Parent:     0ce0060f103db02edcaa000bbd31cdebcfaa115c
Author:     Akinobu Mita <akinobu.mita at gmail.com>
AuthorDate: Sun Aug 26 21:06:44 2012 +0900
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Sat Sep 29 15:13:08 2012 +0100

    mtd: mtd_nandecctest: make module_init() return an error code if test fails
    
    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 at gmail.com>
    Signed-off-by: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/tests/mtd_nandecctest.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

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)



More information about the linux-mtd-cvs mailing list