[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251224100329.762141-2-william.hansen.baird@gmail.com>
Date: Wed, 24 Dec 2025 05:02:55 -0500
From: William Hansen-Baird <william.hansen.baird@...il.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Michael Straube <straube.linux@...il.com>,
Hans de Goede <hansg@...nel.org>,
linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org,
William Hansen-Baird <william.hansen.baird@...il.com>
Subject: [PATCH 2/3] staging: rtl8723bs: core: remove unnecessary else-statements
Remove else statements where the preceding if-statement returns or breaks.
In rtw_mlme.c the if either continues or breaks.
The else-if always breaks, so the else is useless.
Signed-off-by: William Hansen-Baird <william.hansen.baird@...il.com>
---
drivers/staging/rtl8723bs/core/rtw_mlme.c | 6 +-
drivers/staging/rtl8723bs/core/rtw_sta_mgt.c | 97 +++++++++----------
.../staging/rtl8723bs/core/rtw_wlan_util.c | 8 +-
3 files changed, 54 insertions(+), 57 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index 98704179ad35..6ea08ce05bf1 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -1562,10 +1562,10 @@ void _rtw_join_timeout_handler(struct timer_list *t)
continue;
break;
- } else {
- rtw_indicate_disconnect(adapter);
- break;
}
+
+ rtw_indicate_disconnect(adapter);
+ break;
}
} else {
diff --git a/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c b/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
index 3e80d03c4ec9..7ef22947134b 100644
--- a/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
+++ b/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
@@ -191,77 +191,76 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
/* spin_unlock_bh(&(pfree_sta_queue->lock)); */
spin_unlock_bh(&(pstapriv->sta_hash_lock));
return NULL;
- } else {
- psta = container_of(get_next(&pfree_sta_queue->queue), struct sta_info, list);
+ }
+ psta = container_of(get_next(&pfree_sta_queue->queue), struct sta_info, list);
- list_del_init(&(psta->list));
+ list_del_init(&(psta->list));
- /* spin_unlock_bh(&(pfree_sta_queue->lock)); */
+ /* spin_unlock_bh(&(pfree_sta_queue->lock)); */
- _rtw_init_stainfo(psta);
+ _rtw_init_stainfo(psta);
- psta->padapter = pstapriv->padapter;
+ psta->padapter = pstapriv->padapter;
- memcpy(psta->hwaddr, hwaddr, ETH_ALEN);
+ memcpy(psta->hwaddr, hwaddr, ETH_ALEN);
- index = wifi_mac_hash(hwaddr);
+ index = wifi_mac_hash(hwaddr);
- if (index >= NUM_STA) {
- spin_unlock_bh(&(pstapriv->sta_hash_lock));
- psta = NULL;
- goto exit;
- }
- phash_list = &(pstapriv->sta_hash[index]);
+ if (index >= NUM_STA) {
+ spin_unlock_bh(&(pstapriv->sta_hash_lock));
+ psta = NULL;
+ goto exit;
+ }
+ phash_list = &(pstapriv->sta_hash[index]);
- /* spin_lock_bh(&(pstapriv->sta_hash_lock)); */
+ /* spin_lock_bh(&(pstapriv->sta_hash_lock)); */
- list_add_tail(&psta->hash_list, phash_list);
+ list_add_tail(&psta->hash_list, phash_list);
- pstapriv->asoc_sta_count++;
+ pstapriv->asoc_sta_count++;
- /* spin_unlock_bh(&(pstapriv->sta_hash_lock)); */
+ /* spin_unlock_bh(&(pstapriv->sta_hash_lock)); */
-/* Commented by Albert 2009/08/13 */
-/* For the SMC router, the sequence number of first packet of WPS handshake will be 0. */
-/* In this case, this packet will be dropped by recv_decache function if we use the 0x00 as the default value for tid_rxseq variable. */
-/* So, we initialize the tid_rxseq variable as the 0xffff. */
+ /* Commented by Albert 2009/08/13 */
+ /* For the SMC router, the sequence number of first packet of WPS handshake will be 0. */
+ /* In this case, this packet will be dropped by recv_decache function if we use the 0x00 as the default value for tid_rxseq variable. */
+ /* So, we initialize the tid_rxseq variable as the 0xffff. */
- for (i = 0; i < 16; i++)
- memcpy(&psta->sta_recvpriv.rxcache.tid_rxseq[i], &wRxSeqInitialValue, 2);
+ for (i = 0; i < 16; i++)
+ memcpy(&psta->sta_recvpriv.rxcache.tid_rxseq[i], &wRxSeqInitialValue, 2);
- timer_setup(&psta->addba_retry_timer, addba_timer_hdl, 0);
+ timer_setup(&psta->addba_retry_timer, addba_timer_hdl, 0);
- /* for A-MPDU Rx reordering buffer control */
- for (i = 0; i < 16 ; i++) {
- preorder_ctrl = &psta->recvreorder_ctrl[i];
+ /* for A-MPDU Rx reordering buffer control */
+ for (i = 0; i < 16 ; i++) {
+ preorder_ctrl = &psta->recvreorder_ctrl[i];
- preorder_ctrl->padapter = pstapriv->padapter;
+ preorder_ctrl->padapter = pstapriv->padapter;
- preorder_ctrl->enable = false;
+ preorder_ctrl->enable = false;
- preorder_ctrl->indicate_seq = 0xffff;
- preorder_ctrl->wend_b = 0xffff;
- /* preorder_ctrl->wsize_b = (NR_RECVBUFF-2); */
- preorder_ctrl->wsize_b = 64;/* 64; */
+ preorder_ctrl->indicate_seq = 0xffff;
+ preorder_ctrl->wend_b = 0xffff;
+ /* preorder_ctrl->wsize_b = (NR_RECVBUFF-2); */
+ preorder_ctrl->wsize_b = 64;/* 64; */
- INIT_LIST_HEAD(&preorder_ctrl->pending_recvframe_queue.queue);
- spin_lock_init(&preorder_ctrl->pending_recvframe_queue.lock);
+ INIT_LIST_HEAD(&preorder_ctrl->pending_recvframe_queue.queue);
+ spin_lock_init(&preorder_ctrl->pending_recvframe_queue.lock);
- /* init recv timer */
- timer_setup(&preorder_ctrl->reordering_ctrl_timer,
- rtw_reordering_ctrl_timeout_handler, 0);
- }
+ /* init recv timer */
+ timer_setup(&preorder_ctrl->reordering_ctrl_timer,
+ rtw_reordering_ctrl_timeout_handler, 0);
+ }
- /* init for DM */
- psta->rssi_stat.UndecoratedSmoothedPWDB = (-1);
- psta->rssi_stat.UndecoratedSmoothedCCK = (-1);
+ /* init for DM */
+ psta->rssi_stat.UndecoratedSmoothedPWDB = (-1);
+ psta->rssi_stat.UndecoratedSmoothedCCK = (-1);
- /* init for the sequence number of received management frame */
- psta->RxMgmtFrameSeqNum = 0xffff;
- spin_unlock_bh(&(pstapriv->sta_hash_lock));
- /* alloc mac id for non-bc/mc station, */
- rtw_alloc_macid(pstapriv->padapter, psta);
- }
+ /* init for the sequence number of received management frame */
+ psta->RxMgmtFrameSeqNum = 0xffff;
+ spin_unlock_bh(&(pstapriv->sta_hash_lock));
+ /* alloc mac id for non-bc/mc station, */
+ rtw_alloc_macid(pstapriv->padapter, psta);
exit:
diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index 5ffefa50699e..ad33c7947348 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -694,8 +694,8 @@ int WMM_param_handler(struct adapter *padapter, struct ndis_80211_var_ie *pIE)
if (!memcmp(&(pmlmeinfo->WMM_param), (pIE->data + 6), sizeof(struct WMM_para_element)))
return false;
- else
- memcpy(&(pmlmeinfo->WMM_param), (pIE->data + 6), sizeof(struct WMM_para_element));
+
+ memcpy(&(pmlmeinfo->WMM_param), (pIE->data + 6), sizeof(struct WMM_para_element));
pmlmeinfo->WMM_enable = 1;
return true;
@@ -1450,9 +1450,7 @@ unsigned char check_assoc_AP(u8 *pframe, uint len)
return get_realtek_assoc_AP_vender(pIE);
else if (!memcmp(pIE->data, AIRGOCAP_OUI, 3))
return HT_IOT_PEER_AIRGO;
- else
- break;
-
+ break;
default:
break;
}
--
2.52.0
Powered by blists - more mailing lists