mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-16 07:51:31 -04:00
staging: rtl8723bs: replace deeply nested if-else with switch-case
The main logic of the validate_recv_mgnt_frame() function is deeply nested due to multiple if-else statements and additional block scope. Fix this by replacing identical if-else with switch-case statements, which will improve code readability and correct checkpatch.pl warnings about line lengths. Signed-off-by: Nikolay Kulikov <nikolayof23@gmail.com> Link: https://patch.msgid.link/20260323150650.7168-2-nikolayof23@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
8c964b82a4
commit
c4587d059e
@@ -1250,33 +1250,41 @@ static union recv_frame *recvframe_chk_defrag(struct adapter *padapter, union re
|
||||
static signed int validate_recv_mgnt_frame(struct adapter *padapter, union recv_frame *precv_frame)
|
||||
{
|
||||
/* struct mlme_priv *pmlmepriv = &adapter->mlmepriv; */
|
||||
struct sta_info *psta;
|
||||
|
||||
precv_frame = recvframe_chk_defrag(padapter, precv_frame);
|
||||
if (!precv_frame)
|
||||
return _SUCCESS;
|
||||
|
||||
{
|
||||
/* for rx pkt statistics */
|
||||
struct sta_info *psta = rtw_get_stainfo(&padapter->stapriv, GetAddr2Ptr(precv_frame->u.hdr.rx_data));
|
||||
/* for rx pkt statistics */
|
||||
psta = rtw_get_stainfo(&padapter->stapriv, GetAddr2Ptr(precv_frame->u.hdr.rx_data));
|
||||
if (!psta)
|
||||
goto exit;
|
||||
|
||||
if (psta) {
|
||||
psta->sta_stats.rx_mgnt_pkts++;
|
||||
if (GetFrameSubType(precv_frame->u.hdr.rx_data) == WIFI_BEACON)
|
||||
psta->sta_stats.rx_beacon_pkts++;
|
||||
else if (GetFrameSubType(precv_frame->u.hdr.rx_data) == WIFI_PROBEREQ)
|
||||
psta->sta_stats.rx_probereq_pkts++;
|
||||
else if (GetFrameSubType(precv_frame->u.hdr.rx_data) == WIFI_PROBERSP) {
|
||||
if (!memcmp(padapter->eeprompriv.mac_addr, GetAddr1Ptr(precv_frame->u.hdr.rx_data), ETH_ALEN))
|
||||
psta->sta_stats.rx_probersp_pkts++;
|
||||
else if (is_broadcast_mac_addr(GetAddr1Ptr(precv_frame->u.hdr.rx_data)) ||
|
||||
is_multicast_mac_addr(GetAddr1Ptr(precv_frame->u.hdr.rx_data)))
|
||||
psta->sta_stats.rx_probersp_bm_pkts++;
|
||||
else
|
||||
psta->sta_stats.rx_probersp_uo_pkts++;
|
||||
}
|
||||
}
|
||||
psta->sta_stats.rx_mgnt_pkts++;
|
||||
|
||||
switch (GetFrameSubType(precv_frame->u.hdr.rx_data)) {
|
||||
case WIFI_BEACON:
|
||||
psta->sta_stats.rx_beacon_pkts++;
|
||||
break;
|
||||
case WIFI_PROBEREQ:
|
||||
psta->sta_stats.rx_probereq_pkts++;
|
||||
break;
|
||||
case WIFI_PROBERSP:
|
||||
if (!memcmp(padapter->eeprompriv.mac_addr,
|
||||
GetAddr1Ptr(precv_frame->u.hdr.rx_data),
|
||||
ETH_ALEN))
|
||||
psta->sta_stats.rx_probersp_pkts++;
|
||||
else if (is_broadcast_mac_addr(GetAddr1Ptr(precv_frame->u.hdr.rx_data)) ||
|
||||
is_multicast_mac_addr(GetAddr1Ptr(precv_frame->u.hdr.rx_data)))
|
||||
psta->sta_stats.rx_probersp_bm_pkts++;
|
||||
else
|
||||
psta->sta_stats.rx_probersp_uo_pkts++;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
exit:
|
||||
mgt_dispatcher(padapter, precv_frame);
|
||||
|
||||
return _SUCCESS;
|
||||
|
||||
Reference in New Issue
Block a user