linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH]  mtd: spi-nor: remove redundant continue statement
@ 2021-06-18  9:33 Colin King
  2021-06-18  9:40 ` Michael Walle
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Colin King @ 2021-06-18  9:33 UTC (permalink / raw)
  To: Tudor Ambarus, Michael Walle, Pratyush Yadav, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra, linux-mtd
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

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 <colin.king@canonical.com>
---
 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


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

* Re: [PATCH]  mtd: spi-nor: remove redundant continue statement
  2021-06-18  9:33 [PATCH] mtd: spi-nor: remove redundant continue statement Colin King
@ 2021-06-18  9:40 ` Michael Walle
  2021-06-18  9:49 ` Pratyush Yadav
  2021-06-22 12:14 ` Vignesh Raghavendra
  2 siblings, 0 replies; 4+ messages in thread
From: Michael Walle @ 2021-06-18  9:40 UTC (permalink / raw)
  To: Colin King
  Cc: Tudor Ambarus, Pratyush Yadav, Miquel Raynal, Richard Weinberger,
	Vignesh Raghavendra, linux-mtd, kernel-janitors, linux-kernel

Am 2021-06-18 11:33, schrieb Colin King:
> From: Colin Ian King <colin.king@canonical.com>
> 
> 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 <colin.king@canonical.com>

Reviewed-by: Michael Walle <michael@walle.cc>

-michael

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

* Re: [PATCH]  mtd: spi-nor: remove redundant continue statement
  2021-06-18  9:33 [PATCH] mtd: spi-nor: remove redundant continue statement Colin King
  2021-06-18  9:40 ` Michael Walle
@ 2021-06-18  9:49 ` Pratyush Yadav
  2021-06-22 12:14 ` Vignesh Raghavendra
  2 siblings, 0 replies; 4+ messages in thread
From: Pratyush Yadav @ 2021-06-18  9:49 UTC (permalink / raw)
  To: Colin King
  Cc: Tudor Ambarus, Michael Walle, Miquel Raynal, Richard Weinberger,
	Vignesh Raghavendra, linux-mtd, kernel-janitors, linux-kernel

On 18/06/21 10:33AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> 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 <p.yadav@ti.com>


> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  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.

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

* Re: [PATCH] mtd: spi-nor: remove redundant continue statement
  2021-06-18  9:33 [PATCH] mtd: spi-nor: remove redundant continue statement Colin King
  2021-06-18  9:40 ` Michael Walle
  2021-06-18  9:49 ` Pratyush Yadav
@ 2021-06-22 12:14 ` Vignesh Raghavendra
  2 siblings, 0 replies; 4+ messages in thread
From: Vignesh Raghavendra @ 2021-06-22 12:14 UTC (permalink / raw)
  To: Michael Walle, linux-mtd, Colin King, Miquel Raynal,
	Tudor Ambarus, Pratyush Yadav, Richard Weinberger
  Cc: Vignesh Raghavendra, linux-kernel, kernel-janitors

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


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

end of thread, other threads:[~2021-06-22 12:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-18  9:33 [PATCH] mtd: spi-nor: remove redundant continue statement Colin King
2021-06-18  9:40 ` Michael Walle
2021-06-18  9:49 ` Pratyush Yadav
2021-06-22 12:14 ` Vignesh Raghavendra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).