linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] mtd: cfi: Get rid of redundant 'else'
@ 2024-05-03 18:42 Andy Shevchenko
  2024-05-03 18:49 ` Jeff Johnson
  2024-05-27 12:16 ` Miquel Raynal
  0 siblings, 2 replies; 3+ messages in thread
From: Andy Shevchenko @ 2024-05-03 18:42 UTC (permalink / raw)
  To: Andy Shevchenko, linux-mtd, linux-kernel
  Cc: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra

In the snippets like the following

	if (...)
		return / goto / break / continue ...;
	else
		...

the 'else' is redundant. Get rid of it.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 include/linux/mtd/cfi.h | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
index 947410faf9e2..35ca19ae21ae 100644
--- a/include/linux/mtd/cfi.h
+++ b/include/linux/mtd/cfi.h
@@ -308,32 +308,32 @@ static inline uint8_t cfi_read_query(struct map_info *map, uint32_t addr)
 {
 	map_word val = map_read(map, addr);
 
-	if (map_bankwidth_is_1(map)) {
+	if (map_bankwidth_is_1(map))
 		return val.x[0];
-	} else if (map_bankwidth_is_2(map)) {
+	if (map_bankwidth_is_2(map))
 		return cfi16_to_cpu(map, val.x[0]);
-	} else {
-		/* No point in a 64-bit byteswap since that would just be
-		   swapping the responses from different chips, and we are
-		   only interested in one chip (a representative sample) */
-		return cfi32_to_cpu(map, val.x[0]);
-	}
+	/*
+	 * No point in a 64-bit byteswap since that would just be
+	 * swapping the responses from different chips, and we are
+	 * only interested in one chip (a representative sample)
+	 */
+	return cfi32_to_cpu(map, val.x[0]);
 }
 
 static inline uint16_t cfi_read_query16(struct map_info *map, uint32_t addr)
 {
 	map_word val = map_read(map, addr);
 
-	if (map_bankwidth_is_1(map)) {
+	if (map_bankwidth_is_1(map))
 		return val.x[0] & 0xff;
-	} else if (map_bankwidth_is_2(map)) {
+	if (map_bankwidth_is_2(map))
 		return cfi16_to_cpu(map, val.x[0]);
-	} else {
-		/* No point in a 64-bit byteswap since that would just be
-		   swapping the responses from different chips, and we are
-		   only interested in one chip (a representative sample) */
-		return cfi32_to_cpu(map, val.x[0]);
-	}
+	/*
+	 * No point in a 64-bit byteswap since that would just be
+	 * swapping the responses from different chips, and we are
+	 * only interested in one chip (a representative sample)
+	 */
+	return cfi32_to_cpu(map, val.x[0]);
 }
 
 void cfi_udelay(int us);
-- 
2.43.0.rc1.1336.g36b5255a03ac


______________________________________________________
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 v1 1/1] mtd: cfi: Get rid of redundant 'else'
  2024-05-03 18:42 [PATCH v1 1/1] mtd: cfi: Get rid of redundant 'else' Andy Shevchenko
@ 2024-05-03 18:49 ` Jeff Johnson
  2024-05-27 12:16 ` Miquel Raynal
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff Johnson @ 2024-05-03 18:49 UTC (permalink / raw)
  To: Andy Shevchenko, linux-mtd, linux-kernel
  Cc: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra

On 5/3/2024 11:42 AM, Andy Shevchenko wrote:
> In the snippets like the following
> 
> 	if (...)
> 		return / goto / break / continue ...;
> 	else
> 		...
> 
> the 'else' is redundant. Get rid of it.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>

> ---
>  include/linux/mtd/cfi.h | 32 ++++++++++++++++----------------
>  1 file changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
> index 947410faf9e2..35ca19ae21ae 100644
> --- a/include/linux/mtd/cfi.h
> +++ b/include/linux/mtd/cfi.h
> @@ -308,32 +308,32 @@ static inline uint8_t cfi_read_query(struct map_info *map, uint32_t addr)
>  {
>  	map_word val = map_read(map, addr);
>  
> -	if (map_bankwidth_is_1(map)) {
> +	if (map_bankwidth_is_1(map))
>  		return val.x[0];
> -	} else if (map_bankwidth_is_2(map)) {
> +	if (map_bankwidth_is_2(map))
>  		return cfi16_to_cpu(map, val.x[0]);
> -	} else {
> -		/* No point in a 64-bit byteswap since that would just be
> -		   swapping the responses from different chips, and we are
> -		   only interested in one chip (a representative sample) */
> -		return cfi32_to_cpu(map, val.x[0]);
> -	}
> +	/*
> +	 * No point in a 64-bit byteswap since that would just be
> +	 * swapping the responses from different chips, and we are
> +	 * only interested in one chip (a representative sample)
> +	 */
> +	return cfi32_to_cpu(map, val.x[0]);
>  }
>  
>  static inline uint16_t cfi_read_query16(struct map_info *map, uint32_t addr)
>  {
>  	map_word val = map_read(map, addr);
>  
> -	if (map_bankwidth_is_1(map)) {
> +	if (map_bankwidth_is_1(map))
>  		return val.x[0] & 0xff;
> -	} else if (map_bankwidth_is_2(map)) {
> +	if (map_bankwidth_is_2(map))
>  		return cfi16_to_cpu(map, val.x[0]);
> -	} else {
> -		/* No point in a 64-bit byteswap since that would just be
> -		   swapping the responses from different chips, and we are
> -		   only interested in one chip (a representative sample) */
> -		return cfi32_to_cpu(map, val.x[0]);
> -	}
> +	/*
> +	 * No point in a 64-bit byteswap since that would just be
> +	 * swapping the responses from different chips, and we are
> +	 * only interested in one chip (a representative sample)
> +	 */
> +	return cfi32_to_cpu(map, val.x[0]);
>  }
>  
>  void cfi_udelay(int us);


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

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

* Re: [PATCH v1 1/1] mtd: cfi: Get rid of redundant 'else'
  2024-05-03 18:42 [PATCH v1 1/1] mtd: cfi: Get rid of redundant 'else' Andy Shevchenko
  2024-05-03 18:49 ` Jeff Johnson
@ 2024-05-27 12:16 ` Miquel Raynal
  1 sibling, 0 replies; 3+ messages in thread
From: Miquel Raynal @ 2024-05-27 12:16 UTC (permalink / raw)
  To: Andy Shevchenko, linux-mtd, linux-kernel
  Cc: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra

On Fri, 2024-05-03 at 18:42:30 UTC, Andy Shevchenko wrote:
> In the snippets like the following
> 
> 	if (...)
> 		return / goto / break / continue ...;
> 	else
> 		...
> 
> the 'else' is redundant. Get rid of it.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.

Miquel

______________________________________________________
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:[~2024-05-27 12:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-03 18:42 [PATCH v1 1/1] mtd: cfi: Get rid of redundant 'else' Andy Shevchenko
2024-05-03 18:49 ` Jeff Johnson
2024-05-27 12:16 ` Miquel Raynal

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).