Fix checkpatch warning:
else is not generally useful after a break or return
Signed-off-by: Meir Elisha <meir6264@Gmail.com>
---
drivers/staging/rtl8723bs/core/rtw_mlme.c | 40 +++++++++--------------
1 file changed, 16 insertions(+), 24 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index 13bc0ebca247..6a9b57fd1a97 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -1498,30 +1498,25 @@ void _rtw_join_timeout_handler(struct timer_list *t)
spin_lock_bh(&pmlmepriv->lock);
- if (rtw_to_roam(adapter) > 0) { /* join timeout caused by roaming */
+ if (rtw_to_roam(adapter) == 0) {
+ rtw_indicate_disconnect(adapter);
+ free_scanqueue(pmlmepriv);
+ /* indicate disconnect for the case that join_timeout
+ * and check_fwstate != FW_LINKED
+ */
+ rtw_cfg80211_indicate_disconnect(adapter);
+ } else { /* join timeout caused by roaming */
while (1) {
rtw_dec_to_roam(adapter);
- if (rtw_to_roam(adapter) != 0) { /* try another */
- int do_join_r;
-
- do_join_r = rtw_do_join(adapter);
- if (do_join_r != _SUCCESS)
- continue;
-
- break;
- } else {
+ if (rtw_to_roam(adapter) == 0) {
rtw_indicate_disconnect(adapter);
break;
+ } else if (rtw_do_join(adapter) != _SUCCESS) { /* try another */
+ continue;
}
- }
-
- } else {
- rtw_indicate_disconnect(adapter);
- free_scanqueue(pmlmepriv);/* */
-
- /* indicate disconnect for the case that join_timeout and check_fwstate != FW_LINKED */
- rtw_cfg80211_indicate_disconnect(adapter);
+ break;
+ }
}
spin_unlock_bh(&pmlmepriv->lock);
@@ -2052,12 +2047,9 @@ 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) {
- return ielength;
- } else {
- if (authmode == WLAN_EID_RSN)
- ielength = rtw_append_pmkid(adapter, iEntry, out_ie, ielength);
- }
+ if (iEntry > 0 && authmode == WLAN_EID_RSN)
+ ielength = rtw_append_pmkid(adapter, iEntry, out_ie, ielength);
+
return ielength;
}
--
2.34.1
On Thu, Feb 01, 2024 at 04:04:59PM +0200, Meir Elisha wrote:
> Fix checkpatch warning:
> else is not generally useful after a break or return
>
This commit message doesn't work. It needs to explain why you didn't
just delete the else statement and pull the code in tab. And, honestly,
that's what you should have done...
regards,
dan carpenter
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index b221913733fb..c99fa5f1716a 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -1552,10 +1552,9 @@ void _rtw_join_timeout_handler(struct timer_list *t)
continue;
}
break;
- } else {
- rtw_indicate_disconnect(adapter);
- break;
}
+ rtw_indicate_disconnect(adapter);
+ break;
}
} else {
@@ -2103,12 +2102,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;
}
© 2016 - 2025 Red Hat, Inc.