]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
staging: rtl8723bs: core: remove unnecessary else-statements
authorWilliam Hansen-Baird <william.hansen.baird@gmail.com>
Wed, 24 Dec 2025 10:02:55 +0000 (05:02 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 11 Jan 2026 12:51:59 +0000 (13:51 +0100)
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>
Link: https://patch.msgid.link/20251224100329.762141-2-william.hansen.baird@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723bs/core/rtw_mlme.c
drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
drivers/staging/rtl8723bs/core/rtw_wlan_util.c

index 5f74d496c71219f21842e6694dc8da0b48cd2632..f81a29cd6a78e1d1533afae3407aae088eb3bcb3 100644 (file)
@@ -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 {
index 3e80d03c4ec93b5716d622f678903f29d4f962de..7ef22947134bc689ee658e2425ef10e24b8122f7 100644 (file)
@@ -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:
 
index 5ffefa50699edcb53b4c618181fd1a1922375a82..ad33c7947348e924e0c56ed23b2bd12f1f8c7432 100644 (file)
@@ -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;
                }