From: Martin Kaiser Date: Sun, 3 Apr 2022 16:54:31 +0000 (+0200) Subject: staging: r8188eu: simplify error handling X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=d3a0a1dccc20618efdb575f5d95b746a7c4e2a3e;p=linux.git 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 Link: https://lore.kernel.org/r/20220403165438.357728-5-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c index c75b0592a63d0..200d8c6c6e11c 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)