Skip to contentSkip to conversation

staging: r8188eu: remove unnecessary braces in if statements

PATCH Superseded Marcelo Aloisio da Silva 2 participants 4 messages Feb 18, 2022 – Feb 20, 2022 1 message not in the archive Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#1 lore raw

PATCH 1/1 staging: r8188eu: remove unnecessary braces in if statements

In reply to a message not in the archive

Braces are not necessary for single statement blocks.

---
 drivers/staging/r8188eu/core/rtw_mlme.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/staging/r8188eu/core/rtw_mlme.c +2 -6
index 45eff3018d73..ad1d73a27548 100644
@@ -1379,10 +1379,8 @@ void rtw_dynamic_check_timer_handlder(struct adapter *adapter)
 	if (pregistrypriv->wifi_spec == 1) {
 		struct wifidirect_info *pwdinfo = &adapter->wdinfo;
 		if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
-		{
 			/* auto site survey */
 			rtw_auto_scan_handler(adapter);
-		}
 	}
 
 	rcu_read_lock();
@@ -1392,14 +1390,12 @@ void rtw_dynamic_check_timer_handlder(struct adapter *adapter)
 		/*  expire NAT2.5 entry */
 		nat25_db_expire(adapter);
 
-		if (adapter->pppoe_connection_in_progress > 0) {
+		if (adapter->pppoe_connection_in_progress > 0)
 			adapter->pppoe_connection_in_progress--;
-		}
 
 		/*  due to rtw_dynamic_check_timer_handlder() is called every 2 seconds */
-		if (adapter->pppoe_connection_in_progress > 0) {
+		if (adapter->pppoe_connection_in_progress > 0)
 			adapter->pppoe_connection_in_progress--;
-		}
 	}
 
 	rcu_read_unlock();
Signature · 1 line
2.25.1
#2 lore raw
Quoted 12 lines · Marcelo Aloisio da Silva

Braces are not necessary for single statement blocks.

---
 drivers/staging/r8188eu/core/rtw_mlme.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/staging/r8188eu/core/rtw_mlme.c +0 -0
index 45eff3018d73..ad1d73a27548 100644

drivers/staging/r8188eu/core/rtw_mlme.c void rtw_dynamic_check_timer_handlder(struct adapter *adapter) · line 1385

Quoted 7 lines
drivers/staging/r8188eu/core/rtw_mlme.c +0 -2
@@ -1379,10 +1379,8 @@ void rtw_dynamic_check_timer_handlder(struct adapter *adapter)
 	if (pregistrypriv->wifi_spec == 1) {
 		struct wifidirect_info *pwdinfo = &adapter->wdinfo;
 		if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
-		{
 			/* auto site survey */
 			rtw_auto_scan_handler(adapter);
-		}

Generally we prefer if statements around multi-line indents. It helps for readability. But you could move them to the right place in a different patch.

if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) {
/* auto site survey */

 			rtw_auto_scan_handler(adapter);
		}

The rest of the patch is fine.

regards,
dan carpenter

#3 lore raw
Quoted 8 lines · Dan Carpenter
Quoted 7 lines · Marcelo Aloisio da Silva

Braces are not necessary for single statement blocks.

---
 drivers/staging/r8188eu/core/rtw_mlme.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
Quoted 14 lines

drivers/staging/r8188eu/core/rtw_mlme.c void rtw_dynamic_check_timer_handlder(struct adapter *adapter) · line 1385

Quoted 12 lines
drivers/staging/r8188eu/core/rtw_mlme.c +0 -2
index 45eff3018d73..ad1d73a27548 100644
@@ -1379,10 +1379,8 @@ void rtw_dynamic_check_timer_handlder(struct adapter *adapter)
 	if (pregistrypriv->wifi_spec == 1) {
 		struct wifidirect_info *pwdinfo = &adapter->wdinfo;
 		if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
-		{
 			/* auto site survey */
 			rtw_auto_scan_handler(adapter);
-		}

Generally we prefer if statements around multi-line indents. It helps

I meant "prefer curly braces around multi-line indents".

regards,
dan carpenter

#4 lore raw
Quoted 24 lines · Dan Carpenter
Quoted 8 lines · Dan Carpenter
Quoted 7 lines · Marcelo Aloisio da Silva

Braces are not necessary for single statement blocks.

---
 drivers/staging/r8188eu/core/rtw_mlme.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
Quoted 14 lines

drivers/staging/r8188eu/core/rtw_mlme.c void rtw_dynamic_check_timer_handlder(struct adapter *adapter) · line 1385

Quoted 12 lines
drivers/staging/r8188eu/core/rtw_mlme.c +0 -2
index 45eff3018d73..ad1d73a27548 100644
@@ -1379,10 +1379,8 @@ void rtw_dynamic_check_timer_handlder(struct adapter *adapter)
 	if (pregistrypriv->wifi_spec == 1) {
 		struct wifidirect_info *pwdinfo = &adapter->wdinfo;
 		if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
-		{
 			/* auto site survey */
 			rtw_auto_scan_handler(adapter);
-		}

Generally we prefer if statements around multi-line indents. It helps

Quoted 5 lines

I meant "prefer curly braces around multi-line indents".

regards,
dan carpenter

Thanks Dan for the feedback.
I'll fix the brace for this if statement in another patch.

Regards,
Marcelo