* [PATCH 1/3] staging: rtl8723bs: core: remove empty if-statements
@ 2025-12-24 10:02 William Hansen-Baird
2025-12-24 10:02 ` [PATCH 2/3] staging: rtl8723bs: core: remove unnecessary else-statements William Hansen-Baird
2025-12-24 10:02 ` [PATCH 3/3] staging: rtl8723bs: core: move constants to right side in comparison William Hansen-Baird
0 siblings, 2 replies; 3+ messages in thread
From: William Hansen-Baird @ 2025-12-24 10:02 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Michael Straube, Hans de Goede, linux-staging, linux-kernel,
William Hansen-Baird
This patch removes if-statements with no body in rtw_recv.c and rtw_xmit.c.
If-statement conditions have no side-effect and can be safely removed.
Signed-off-by: William Hansen-Baird <william.hansen.baird@gmail.com>
---
drivers/staging/rtl8723bs/core/rtw_recv.c | 3 ---
drivers/staging/rtl8723bs/core/rtw_xmit.c | 2 --
2 files changed, 5 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c b/drivers/staging/rtl8723bs/core/rtw_recv.c
index e893cb6fa273..24cc4a9e0445 100644
--- a/drivers/staging/rtl8723bs/core/rtw_recv.c
+++ b/drivers/staging/rtl8723bs/core/rtw_recv.c
@@ -2035,9 +2035,6 @@ static int recv_indicatepkt_reorder(struct adapter *padapter, union recv_frame *
preorder_ctrl->indicate_seq = (preorder_ctrl->indicate_seq + 1)%4096;
- if (retval != _SUCCESS) {
- }
-
return retval;
}
}
diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c b/drivers/staging/rtl8723bs/core/rtw_xmit.c
index 21690857fd62..ae482c28b40b 100644
--- a/drivers/staging/rtl8723bs/core/rtw_xmit.c
+++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c
@@ -1707,8 +1707,6 @@ s32 rtw_free_xmitframe(struct xmit_priv *pxmitpriv, struct xmit_frame *pxmitfram
queue = &pxmitpriv->free_xmit_queue;
else if (pxmitframe->ext_tag == 1)
queue = &pxmitpriv->free_xframe_ext_queue;
- else {
- }
spin_lock_bh(&queue->lock);
--
2.52.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/3] staging: rtl8723bs: core: remove unnecessary else-statements
2025-12-24 10:02 [PATCH 1/3] staging: rtl8723bs: core: remove empty if-statements William Hansen-Baird
@ 2025-12-24 10:02 ` William Hansen-Baird
2025-12-24 10:02 ` [PATCH 3/3] staging: rtl8723bs: core: move constants to right side in comparison William Hansen-Baird
1 sibling, 0 replies; 3+ messages in thread
From: William Hansen-Baird @ 2025-12-24 10:02 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Michael Straube, Hans de Goede, linux-staging, linux-kernel,
William Hansen-Baird
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@gmail.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
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 3/3] staging: rtl8723bs: core: move constants to right side in comparison
2025-12-24 10:02 [PATCH 1/3] staging: rtl8723bs: core: remove empty if-statements William Hansen-Baird
2025-12-24 10:02 ` [PATCH 2/3] staging: rtl8723bs: core: remove unnecessary else-statements William Hansen-Baird
@ 2025-12-24 10:02 ` William Hansen-Baird
1 sibling, 0 replies; 3+ messages in thread
From: William Hansen-Baird @ 2025-12-24 10:02 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Michael Straube, Hans de Goede, linux-staging, linux-kernel,
William Hansen-Baird
Move constants to right side in if-statement conditions.
Signed-off-by: William Hansen-Baird <william.hansen.baird@gmail.com>
---
drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 4 ++--
drivers/staging/rtl8723bs/core/rtw_security.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index 8fdeeda88a6d..92b12a13d27c 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -1009,7 +1009,7 @@ static int rtw_get_cipher_info(struct wlan_network *pnetwork)
pbuf = rtw_get_wpa_ie(&pnetwork->network.ies[12], &wpa_ielen, pnetwork->network.ie_length-12);
if (pbuf && (wpa_ielen > 0)) {
- if (_SUCCESS == rtw_parse_wpa_ie(pbuf, wpa_ielen+2, &group_cipher, &pairwise_cipher, &is8021x)) {
+ if (rtw_parse_wpa_ie(pbuf, wpa_ielen+2, &group_cipher, &pairwise_cipher, &is8021x) == _SUCCESS) {
pnetwork->bcn_info.pairwise_cipher = pairwise_cipher;
pnetwork->bcn_info.group_cipher = group_cipher;
pnetwork->bcn_info.is_8021x = is8021x;
@@ -1019,7 +1019,7 @@ static int rtw_get_cipher_info(struct wlan_network *pnetwork)
pbuf = rtw_get_wpa2_ie(&pnetwork->network.ies[12], &wpa_ielen, pnetwork->network.ie_length-12);
if (pbuf && (wpa_ielen > 0)) {
- if (_SUCCESS == rtw_parse_wpa2_ie(pbuf, wpa_ielen+2, &group_cipher, &pairwise_cipher, &is8021x)) {
+ if (rtw_parse_wpa2_ie(pbuf, wpa_ielen+2, &group_cipher, &pairwise_cipher, &is8021x) == _SUCCESS) {
pnetwork->bcn_info.pairwise_cipher = pairwise_cipher;
pnetwork->bcn_info.group_cipher = group_cipher;
pnetwork->bcn_info.is_8021x = is8021x;
diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c
index 2f941ffbd465..86e54454145a 100644
--- a/drivers/staging/rtl8723bs/core/rtw_security.c
+++ b/drivers/staging/rtl8723bs/core/rtw_security.c
@@ -1488,7 +1488,7 @@ void rtw_sec_restore_wep_key(struct adapter *adapter)
struct security_priv *securitypriv = &(adapter->securitypriv);
signed int keyid;
- if ((_WEP40_ == securitypriv->dot11PrivacyAlgrthm) || (_WEP104_ == securitypriv->dot11PrivacyAlgrthm)) {
+ if ((securitypriv->dot11PrivacyAlgrthm == _WEP40_) || (securitypriv->dot11PrivacyAlgrthm == _WEP104_)) {
for (keyid = 0; keyid < 4; keyid++) {
if (securitypriv->key_mask & BIT(keyid)) {
if (keyid == securitypriv->dot11PrivacyKeyIndex)
--
2.52.0
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-12-24 10:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-24 10:02 [PATCH 1/3] staging: rtl8723bs: core: remove empty if-statements William Hansen-Baird
2025-12-24 10:02 ` [PATCH 2/3] staging: rtl8723bs: core: remove unnecessary else-statements William Hansen-Baird
2025-12-24 10:02 ` [PATCH 3/3] staging: rtl8723bs: core: move constants to right side in comparison William Hansen-Baird
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®