mtd: mtd_oobtest: fix error return code in mtd_oobtest_init()
authorZhang Xiaoxu <zhangxiaoxu5@huawei.com>
Fri, 9 Apr 2021 01:07:39 +0000 (21:07 -0400)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Mon, 10 May 2021 08:44:37 +0000 (10:44 +0200)
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@huawei.com>
Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20210409010739.1021001-1-zhangxiaoxu5@huawei.com
drivers/mtd/tests/oobtest.c

index c71daa89bfce0f26aabcbc0b8d057169109f6af9..590d619d2760ed135ba49d6bb085c2acca7fbadb 100644 (file)
@@ -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;
                        }