staging: rtl8723bs: clean up brace coding style issues
PATCH 1/1 staging: rtl8723bs: clean up brace coding style issues
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
--- drivers/staging/rtl8723bs/core/rtw_efuse.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/rtl8723bs/core/rtw_efuse.c +2 -1
@@ -245,8 +245,9 @@ u16 Address)break ; }return rtw_read8 (Adapter,EFUSE_CTRL ); - }else + }else {return 0xFF ; + } }/* EFUSE_Read1Byte */
Signature · 1 line
2.29.2
Quoted 5 lines · 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
[]
drivers/staging/rtl8723bs/core/rtw_efuse.c
Quoted 1 line
drivers/staging/rtl8723bs/core/rtw_efuse.c +0
-0
[]
drivers/staging/rtl8723bs/core/rtw_efuse.c u16 Address) · line 250
Quoted 8 lines
drivers/staging/rtl8723bs/core/rtw_efuse.c +2
-1@@ -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:
---
drivers/staging/rtl8723bs/core/rtw_efuse.c +23 -23
@@ -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 */