aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Kaiser <martin@kaiser.cx>2022-04-03 18:54:31 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-04-04 16:32:42 +0200
commitd3a0a1dccc20618efdb575f5d95b746a7c4e2a3e (patch)
treeef4dc2b9bf63b7c09b7568abb11cd15a07feb7d6
parentstaging: r8188eu: use ieee80211 helper for retry bit (diff)
staging: r8188eu: simplify error handling
Simplify the error handling in validate_recv_data_frame. The function does not have to do any cleanup for errors, we can return immediately. Signed-off-by: Martin Kaiser <martin@kaiser.cx> Link: https://lore.kernel.org/r/20220403165438.357728-5-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/r8188eu/core/rtw_recv.c33
1 files changed, 11 insertions, 22 deletions
diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c
index c75b0592a63d..200d8c6c6e11 100644
--- a/drivers/staging/r8188eu/core/rtw_recv.c
+++ b/drivers/staging/r8188eu/core/rtw_recv.c
@@ -943,17 +943,15 @@ static int validate_recv_data_frame(struct adapter *adapter,
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)precv_frame->rx_data;
struct rx_pkt_attrib *pattrib = &precv_frame->attrib;
struct security_priv *psecuritypriv = &adapter->securitypriv;
- int ret = _SUCCESS;
+ int ret;
bretry = ieee80211_has_retry(hdr->frame_control);
pda = ieee80211_get_DA(hdr);
psa = ieee80211_get_SA(hdr);
- pbssid = get_hdr_bssid(ptr);
- if (!pbssid) {
- ret = _FAIL;
- goto exit;
- }
+ pbssid = get_hdr_bssid(ptr);
+ if (!pbssid)
+ return _FAIL;
memcpy(pattrib->dst, pda, ETH_ALEN);
memcpy(pattrib->src, psa, ETH_ALEN);
@@ -986,16 +984,11 @@ static int validate_recv_data_frame(struct adapter *adapter,
break;
}
- if (ret == _FAIL) {
- goto exit;
- } else if (ret == RTW_RX_HANDLED) {
- goto exit;
- }
+ if (ret == _FAIL || ret == RTW_RX_HANDLED)
+ return ret;
- if (!psta) {
- ret = _FAIL;
- goto exit;
- }
+ if (!psta)
+ return _FAIL;
/* psta->rssi = prxcmd->rssi; */
/* psta->signal_quality = prxcmd->sq; */
@@ -1023,10 +1016,8 @@ static int validate_recv_data_frame(struct adapter *adapter,
precv_frame->preorder_ctrl = &psta->recvreorder_ctrl[pattrib->priority];
/* decache, drop duplicate recv packets */
- if (recv_decache(precv_frame, bretry, &psta->sta_recvpriv.rxcache) == _FAIL) {
- ret = _FAIL;
- goto exit;
- }
+ if (recv_decache(precv_frame, bretry, &psta->sta_recvpriv.rxcache) == _FAIL)
+ return _FAIL;
if (pattrib->privacy) {
GET_ENCRY_ALGO(psecuritypriv, psta, pattrib->encrypt, is_multicast_ether_addr(pattrib->ra));
@@ -1038,9 +1029,7 @@ static int validate_recv_data_frame(struct adapter *adapter,
pattrib->icv_len = 0;
}
-exit:
-
- return ret;
+ return _SUCCESS;
}
static int validate_recv_frame(struct adapter *adapter, struct recv_frame *precv_frame)