linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8723bs: clean up brace coding style issues
@ 2020-12-22 14:17 Michael Straube
  2020-12-24 17:15 ` Joe Perches
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Straube @ 2020-12-22 14:17 UTC (permalink / raw)
  To: gregkh; +Cc: hdegoede, Larry.Finger, devel, linux-kernel, Michael Straube

Add missing braces around else arm of if else statement to clear
style issues reported by checkpatch.

CHECK: braces {} should be used on all arms of this statement
CHECK: Unbalanced braces around else statement

Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_efuse.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_efuse.c b/drivers/staging/rtl8723bs/core/rtw_efuse.c
index 32ca10f01413..a6c43bc4f62a 100644
--- a/drivers/staging/rtl8723bs/core/rtw_efuse.c
+++ b/drivers/staging/rtl8723bs/core/rtw_efuse.c
@@ -245,8 +245,9 @@ u16 	Address)
 				break;
 		}
 		return rtw_read8(Adapter, EFUSE_CTRL);
-	} else
+	} else {
 		return 0xFF;
+	}
 
 } /* EFUSE_Read1Byte */
 
-- 
2.29.2


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

* Re: [PATCH] staging: rtl8723bs: clean up brace coding style issues
  2020-12-22 14:17 [PATCH] staging: rtl8723bs: clean up brace coding style issues Michael Straube
@ 2020-12-24 17:15 ` Joe Perches
  0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2020-12-24 17:15 UTC (permalink / raw)
  To: Michael Straube, gregkh; +Cc: hdegoede, Larry.Finger, devel, linux-kernel

On Tue, 2020-12-22 at 15:17 +0100, Michael Straube wrote:
> Add missing braces around else arm of if else statement to clear
> style issues reported by checkpatch.
> 
> CHECK: braces {} should be used on all arms of this statement
> CHECK: Unbalanced braces around else statement
[]
> diff --git a/drivers/staging/rtl8723bs/core/rtw_efuse.c b/drivers/staging/rtl8723bs/core/rtw_efuse.c
[]
> @@ -245,8 +245,9 @@ u16 	Address)
>  				break;
>  		}
>  		return rtw_read8(Adapter, EFUSE_CTRL);
> -	} else
> +	} else {
>  		return 0xFF;
> +	}

Instead, when you see a pattern like this it's generally
better to reverse whatever test is above this, return early
and unindent the block above the else.

Here that would be:
---
diff --git a/drivers/staging/rtl8723bs/core/rtw_efuse.c b/drivers/staging/rtl8723bs/core/rtw_efuse.c
index 32ca10f01413..e5c3dba5c8ae 100644
--- a/drivers/staging/rtl8723bs/core/rtw_efuse.c
+++ b/drivers/staging/rtl8723bs/core/rtw_efuse.c
@@ -222,31 +222,31 @@ u16 	Address)
 
 	EFUSE_GetEfuseDefinition(Adapter, EFUSE_WIFI, TYPE_EFUSE_REAL_CONTENT_LEN, (void *)&contentLen, false);
 
-	if (Address < contentLen) {/* E-fuse 512Byte */
-		/* Write E-fuse Register address bit0~7 */
-		temp = Address & 0xFF;
-		rtw_write8(Adapter, EFUSE_CTRL+1, temp);
-		Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+2);
-		/* Write E-fuse Register address bit8~9 */
-		temp = ((Address >> 8) & 0x03) | (Bytetemp & 0xFC);
-		rtw_write8(Adapter, EFUSE_CTRL+2, temp);
-
-		/* Write 0x30[31]= 0 */
-		Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3);
-		temp = Bytetemp & 0x7F;
-		rtw_write8(Adapter, EFUSE_CTRL+3, temp);
+	if (Address >= contentLen)	/* E-fuse 512Byte */
+		return 0xFF;
 
-		/* Wait Write-ready (0x30[31]= 1) */
+	/* Write E-fuse Register address bit0~7 */
+	temp = Address & 0xFF;
+	rtw_write8(Adapter, EFUSE_CTRL+1, temp);
+	Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+2);
+	/* Write E-fuse Register address bit8~9 */
+	temp = ((Address >> 8) & 0x03) | (Bytetemp & 0xFC);
+	rtw_write8(Adapter, EFUSE_CTRL+2, temp);
+
+	/* Write 0x30[31]= 0 */
+	Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3);
+	temp = Bytetemp & 0x7F;
+	rtw_write8(Adapter, EFUSE_CTRL+3, temp);
+
+	/* Wait Write-ready (0x30[31]= 1) */
+	Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3);
+	while (!(Bytetemp & 0x80)) {
 		Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3);
-		while (!(Bytetemp & 0x80)) {
-			Bytetemp = rtw_read8(Adapter, EFUSE_CTRL+3);
-			k++;
-			if (k == 1000)
-				break;
-		}
-		return rtw_read8(Adapter, EFUSE_CTRL);
-	} else
-		return 0xFF;
+		k++;
+		if (k == 1000)
+			break;
+	}
+	return rtw_read8(Adapter, EFUSE_CTRL);
 
 } /* EFUSE_Read1Byte */
 


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

end of thread, other threads:[~2020-12-24 17:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-22 14:17 [PATCH] staging: rtl8723bs: clean up brace coding style issues Michael Straube
2020-12-24 17:15 ` Joe Perches

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