mtd: tests: remove useless checks
PATCH 1/1 mtd: tests: remove useless checks
Return value of mtdtest_scan_for_bad_() is always 0. So it causes senseless checks in some functions such as mtd_subpagetest_init().
--- 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(-)
drivers/mtd/tests/oobtest.c +0 -2
@@ -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;prandom_seed_state (&rnd_state,1 ); err =write_whole_device ();
drivers/mtd/tests/pagetest.c +0 -2
@@ -373,8 +373,6 @@ static int __init mtd_pagetest_init(void)if (!bbt) goto out; err =mtdtest_scan_for_bad_eraseblocks (mtd, bbt,0 , ebcnt); -if (err) - goto out;/* Erase all eraseblocks */ pr_info ("erasing whole device\n" );
drivers/mtd/tests/readtest.c +0 -2
@@ -162,8 +162,6 @@ static int __init mtd_readtest_init(void)if (!bbt) goto out; err =mtdtest_scan_for_bad_eraseblocks (mtd, bbt,0 , ebcnt); -if (err) - goto out;/* Read all eraseblocks 1 page at a time */ pr_info ("testing page read\n" );
drivers/mtd/tests/speedtest.c +1 -2
@@ -229,8 +229,7 @@ static int __init mtd_speedtest_init(void)if (!bbt) goto out; err =mtdtest_scan_for_bad_eraseblocks (mtd, bbt,0 , ebcnt); -if (err) - goto out; +for (i =0 ; i < ebcnt; i++) {if (!bbt[i]) goodebcnt++;
drivers/mtd/tests/stresstest.c +0 -2
@@ -189,8 +189,6 @@ static int __init mtd_stresstest_init(void)if (!bbt) goto out; err =mtdtest_scan_for_bad_eraseblocks (mtd, bbt,0 , ebcnt); -if (err) - goto out;/* Do operations */ pr_info ("doing operations\n" );
drivers/mtd/tests/subpagetest.c +0 -2
@@ -319,8 +319,6 @@ static int __init mtd_subpagetest_init(void) goto out; err =mtdtest_scan_for_bad_eraseblocks (mtd, bbt,0 , ebcnt); -if (err) - goto out; err =mtdtest_erase_good_eraseblocks (mtd, bbt,0 , ebcnt);if (err)
drivers/mtd/tests/torturetest.c +0 -2
@@ -243,8 +243,6 @@ static int __init tort_init(void) } err =mtdtest_scan_for_bad_eraseblocks (mtd, bad_ebs, eb, ebcnt); -if (err) - goto out;start_timing ();while (1 ) {
Signature · 1 line
2.34.1
Miquel Raynal
maintainerHi Igor,
[email protected] wrote on Fri, 1 Sep 2023 16:36:41 +0300:
Quoted 20 lines
Return value of
mtdtest_scan_for_bad_()is always 0. So it causes senseless checks in some functions such asmtd_subpagetest_init().Fixes 084db4b020c7 ("mtd: tests: introduce helper functions")Signed-off-by Dembskiy Igor <[email protected]>--- 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(-)drivers/mtd/tests/oobtest.c +0
-0
drivers/mtd/tests/oobtest.c static int __init mtd_oobtest_init(void) · line 403
Quoted 5 lines
drivers/mtd/tests/oobtest.c +0
-2@@ -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
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Hi,
Quoted 2 lines · Dembskiy Igor
Return value of
mtdtest_scan_for_bad_()is always 0. So it causes senseless
Your function name got cut off.
Quoted 1 line
checks in some functions such as
mtd_subpagetest_init().
Then maybe it should return void?
Quoted 17 lines
Fixes 084db4b020c7 ("mtd: tests: introduce helper functions")Signed-off-by Dembskiy Igor <[email protected]>--- 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(-)drivers/mtd/tests/oobtest.c +0
-0
drivers/mtd/tests/oobtest.c static int __init mtd_oobtest_init(void) · line 403
Quoted 5 lines
drivers/mtd/tests/oobtest.c +0
-2@@ -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;
That's not mtdtest_scan_for_bad_eraseblocks().
Regards,
Jonas
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/