Skip to contentSkip to conversation

staging: rtl8723bs: remove unnecessary else block after return

PATCH In review Abraham Samuel Adekunle 2 participants 2 messages Mar 25, 2025 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8723bs: remove unnecessary else block after return

The else block after the return statement is unnecessary since execution does not continue past the return statement.

Remove the else block while preserving logic making the code cleaner and more readable.

reported by checkpatch:

WARNING: else is not generally useful after a break or return

---
 drivers/staging/rtl8723bs/core/rtw_mlme.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/rtl8723bs/core/rtw_mlme.c +5 -5
index 5ded183aa08c..91c6a962f7e8 100644
@@ -2022,12 +2022,12 @@ signed int rtw_restruct_sec_ie(struct adapter *adapter, u8 *in_ie, u8 *out_ie, u
 	}
 
 	iEntry = SecIsInPMKIDList(adapter, pmlmepriv->assoc_bssid);
-	if (iEntry < 0) {
+	if (iEntry < 0)
 		return ielength;
-	} else {
-		if (authmode == WLAN_EID_RSN)
-			ielength = rtw_append_pmkid(adapter, iEntry, out_ie, ielength);
-	}
+
+	if (authmode == WLAN_EID_RSN)
+		ielength = rtw_append_pmkid(adapter, iEntry, out_ie, ielength);
+
 	return ielength;
 }
 

--
2.34.1

Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Abraham Samuel Adekunle

The else block after the return statement is unnecessary since execution does not continue past the return statement.

Remove the else block while preserving logic making the code cleaner and more readable.

reported by checkpatch:

WARNING: else is not generally useful after a break or return

Quoted 30 lines
---
 drivers/staging/rtl8723bs/core/rtw_mlme.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/rtl8723bs/core/rtw_mlme.c +5 -6
index 5ded183aa08c..91c6a962f7e8 100644
@@ -2022,12 +2022,12 @@ signed int rtw_restruct_sec_ie(struct adapter *adapter, u8 *in_ie, u8 *out_ie, u
 	}
 
 	iEntry = SecIsInPMKIDList(adapter, pmlmepriv->assoc_bssid);
-	if (iEntry < 0) {
+	if (iEntry < 0)
 		return ielength;
-	} else {
-		if (authmode == WLAN_EID_RSN)
-			ielength = rtw_append_pmkid(adapter, iEntry, out_ie, ielength);
-	}
+
+	if (authmode == WLAN_EID_RSN)
+		ielength = rtw_append_pmkid(adapter, iEntry, out_ie, ielength);
+
 	return ielength;
 }
 
--

2.34.1