2021-06-18 09:43:35

by Colin King

[permalink] [raw]
Subject: [PATCH] mtd: spi-nor: remove redundant continue statement

From: Colin Ian King <[email protected]>

The continue statement at the end of a for-loop has no effect,
invert the if expression and remove the continue.

Addresses-Coverity: ("Continue has no effect")
Signed-off-by: Colin Ian King <[email protected]>
---
drivers/mtd/spi-nor/core.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 970ed6e3f3ba..cc08bd707378 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -1411,9 +1411,7 @@ spi_nor_find_best_erase_type(const struct spi_nor_erase_map *map,
continue;

spi_nor_div_by_erase_size(erase, addr, &rem);
- if (rem)
- continue;
- else
+ if (!rem)
return erase;
}

--
2.31.1


2021-06-18 09:46:03

by Michael Walle

[permalink] [raw]
Subject: Re: [PATCH] mtd: spi-nor: remove redundant continue statement

Am 2021-06-18 11:33, schrieb Colin King:
> From: Colin Ian King <[email protected]>
>
> The continue statement at the end of a for-loop has no effect,
> invert the if expression and remove the continue.
>
> Addresses-Coverity: ("Continue has no effect")
> Signed-off-by: Colin Ian King <[email protected]>

Reviewed-by: Michael Walle <[email protected]>

-michael

2021-06-18 09:51:37

by Pratyush Yadav

[permalink] [raw]
Subject: Re: [PATCH] mtd: spi-nor: remove redundant continue statement

On 18/06/21 10:33AM, Colin King wrote:
> From: Colin Ian King <[email protected]>
>
> The continue statement at the end of a for-loop has no effect,
> invert the if expression and remove the continue.
>
> Addresses-Coverity: ("Continue has no effect")

I haven't seen this tag used much before. I am not sure how useful it is.

Other than this,

Reviewed-by: Pratyush Yadav <[email protected]>


> Signed-off-by: Colin Ian King <[email protected]>
> ---
> drivers/mtd/spi-nor/core.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
> index 970ed6e3f3ba..cc08bd707378 100644
> --- a/drivers/mtd/spi-nor/core.c
> +++ b/drivers/mtd/spi-nor/core.c
> @@ -1411,9 +1411,7 @@ spi_nor_find_best_erase_type(const struct spi_nor_erase_map *map,
> continue;
>
> spi_nor_div_by_erase_size(erase, addr, &rem);
> - if (rem)
> - continue;
> - else
> + if (!rem)
> return erase;
> }
>

--
Regards,
Pratyush Yadav
Texas Instruments Inc.

2021-06-22 12:17:06

by Vignesh Raghavendra

[permalink] [raw]
Subject: Re: [PATCH] mtd: spi-nor: remove redundant continue statement

On Fri, 18 Jun 2021 10:33:31 +0100, Colin King wrote:
> The continue statement at the end of a for-loop has no effect,
> invert the if expression and remove the continue.

Applied to spi-nor/next, thanks!
[1/1] mtd: spi-nor: remove redundant continue statement
https://git.kernel.org/mtd/c/c17e5c85b3

--
Regards
Vignesh