public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] mtd: tests: remove useless checks
@ 2023-09-01 13:36 Dembskiy Igor
  2023-09-01 13:42 ` Miquel Raynal
  2023-09-02 10:32 ` Jonas Gorski
  0 siblings, 2 replies; 3+ messages in thread
From: Dembskiy Igor @ 2023-09-01 13:36 UTC (permalink / raw)
  To: Alexey Khoroshilov
  Cc: Dembskiy Igor, Boris Brezillon, Richard Weinberger, Miquel Raynal,
	Akinobu Mita, linux-mtd, linux-kernel, lvc-project

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@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;
 
 	prandom_seed_state(&rnd_state, 1);
 	err = write_whole_device();
diff --git a/drivers/mtd/tests/pagetest.c b/drivers/mtd/tests/pagetest.c
index 8eb40b6e6dfa..a59ef88cdaf3 100644
--- a/drivers/mtd/tests/pagetest.c
+++ b/drivers/mtd/tests/pagetest.c
@@ -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");
diff --git a/drivers/mtd/tests/readtest.c b/drivers/mtd/tests/readtest.c
index 99670ef91f2b..8bc52aca1b2a 100644
--- a/drivers/mtd/tests/readtest.c
+++ b/drivers/mtd/tests/readtest.c
@@ -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");
diff --git a/drivers/mtd/tests/speedtest.c b/drivers/mtd/tests/speedtest.c
index 075bce32caa5..978369f8d4c0 100644
--- a/drivers/mtd/tests/speedtest.c
+++ b/drivers/mtd/tests/speedtest.c
@@ -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++;
diff --git a/drivers/mtd/tests/stresstest.c b/drivers/mtd/tests/stresstest.c
index 8062098930d6..0a1fa8a2078e 100644
--- a/drivers/mtd/tests/stresstest.c
+++ b/drivers/mtd/tests/stresstest.c
@@ -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");
diff --git a/drivers/mtd/tests/subpagetest.c b/drivers/mtd/tests/subpagetest.c
index 05250a080139..5ca93e169a25 100644
--- a/drivers/mtd/tests/subpagetest.c
+++ b/drivers/mtd/tests/subpagetest.c
@@ -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)
diff --git a/drivers/mtd/tests/torturetest.c b/drivers/mtd/tests/torturetest.c
index 841689b4d86d..46634198e19d 100644
--- a/drivers/mtd/tests/torturetest.c
+++ b/drivers/mtd/tests/torturetest.c
@@ -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) {
-- 
2.34.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: tests: remove useless checks
  2023-09-01 13:36 [PATCH] mtd: tests: remove useless checks Dembskiy Igor
@ 2023-09-01 13:42 ` Miquel Raynal
  2023-09-02 10:32 ` Jonas Gorski
  1 sibling, 0 replies; 3+ messages in thread
From: Miquel Raynal @ 2023-09-01 13:42 UTC (permalink / raw)
  To: Dembskiy Igor
  Cc: Alexey Khoroshilov, Boris Brezillon, Richard Weinberger,
	Akinobu Mita, linux-mtd, linux-kernel, lvc-project

Hi Igor,

dii@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@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

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: tests: remove useless checks
  2023-09-01 13:36 [PATCH] mtd: tests: remove useless checks Dembskiy Igor
  2023-09-01 13:42 ` Miquel Raynal
@ 2023-09-02 10:32 ` Jonas Gorski
  1 sibling, 0 replies; 3+ messages in thread
From: Jonas Gorski @ 2023-09-02 10:32 UTC (permalink / raw)
  To: Dembskiy Igor
  Cc: Alexey Khoroshilov, Boris Brezillon, Richard Weinberger,
	Miquel Raynal, Akinobu Mita, linux-mtd, linux-kernel, lvc-project

Hi,

On Fri, 1 Sept 2023 at 15:39, Dembskiy Igor <dii@itb.spb.ru> wrote:
>
> Return value of mtdtest_scan_for_bad_() is always 0. So it causes senseless

Your function name got cut off.

> checks in some functions such as mtd_subpagetest_init().

Then maybe it should return void?

> Fixes: 084db4b020c7 ("mtd: tests: introduce helper functions")
> Signed-off-by: Dembskiy Igor <dii@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;

That's not mtdtest_scan_for_bad_eraseblocks().

Regards,
Jonas

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-09-02 10:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-01 13:36 [PATCH] mtd: tests: remove useless checks Dembskiy Igor
2023-09-01 13:42 ` Miquel Raynal
2023-09-02 10:32 ` Jonas Gorski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox