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

Zhang Xiaoxu zhangxiaoxu5 at huawei.com
Fri Apr 9 02:07:39 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: Zhang Xiaoxu <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