[PATCH] mtd: mtd_oobtest: fix error return code in mtd_oobtest_init()

Zhang Xiaoxu zhangxiaoxu5 at huawei.com
Thu Apr 8 15:24:13 BST 2021


Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Reported-by: Hulk Robot <hulkci at huawei.com>
Signed-off-by: zhangxiaoxu 00467499 <zhangxiaoxu5 at huawei.com>
---
 drivers/mtd/tests/oobtest.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mtd/tests/oobtest.c b/drivers/mtd/tests/oobtest.c
index c71daa89bfce..590d619d2760 100644
--- a/drivers/mtd/tests/oobtest.c
+++ b/drivers/mtd/tests/oobtest.c
@@ -701,6 +701,7 @@ static int __init mtd_oobtest_init(void)
 			       (long long)addr);
 			errcnt += 1;
 			if (errcnt > 1000) {
+				err = -EINVAL;
 				pr_err("error: too many errors\n");
 				goto out;
 			}
-- 
2.25.4




More information about the linux-mtd mailing list