[PATCH] mtd: tests: remove useless checks

Miquel Raynal miquel.raynal at bootlin.com
Fri Sep 1 06:42:42 PDT 2023


Hi Igor,

dii at itb.spb.ru wrote on Fri,  1 Sep 2023 16:36:41 +0300:

> Return value of mtdtest_scan_for_bad_() is always 0. So it causes senseless
> checks in some functions such as mtd_subpagetest_init().
> 
> Fixes: 084db4b020c7 ("mtd: tests: introduce helper functions")
> Signed-off-by: Dembskiy Igor <dii at itb.spb.ru>
> ---
>  drivers/mtd/tests/oobtest.c     | 2 --
>  drivers/mtd/tests/pagetest.c    | 2 --
>  drivers/mtd/tests/readtest.c    | 2 --
>  drivers/mtd/tests/speedtest.c   | 3 +--
>  drivers/mtd/tests/stresstest.c  | 2 --
>  drivers/mtd/tests/subpagetest.c | 2 --
>  drivers/mtd/tests/torturetest.c | 2 --
>  7 files changed, 1 insertion(+), 14 deletions(-)
> 
> diff --git a/drivers/mtd/tests/oobtest.c b/drivers/mtd/tests/oobtest.c
> index 13fed398937e..976f40a5656e 100644
> --- a/drivers/mtd/tests/oobtest.c
> +++ b/drivers/mtd/tests/oobtest.c
> @@ -399,8 +399,6 @@ static int __init mtd_oobtest_init(void)
>  	pr_info("test 1 of 5\n");
>  
>  	err = mtdtest_erase_good_eraseblocks(mtd, bbt, 0, ebcnt);
> -	if (err)
> -		goto out;

What's the point of keeping "err =" or even keeping a return value if
void would be more appropriate?

Thanks,
Miquèl



More information about the linux-mtd mailing list