[OPW,kernel,v3,08/28] staging: rtl8723au: core: rtw_recv.c: Replace non-standard return values
diff mbox

Message ID 1414668396-4093-9-git-send-email-roberta.dobrescu@gmail.com
State New, archived
Headers show

Commit Message

Roberta Dobrescu Oct. 30, 2014, 11:26 a.m. UTC
This patch replaces non-standard return values _SUCCESS/_FAIL with 0
or an appropriate err code and modifies the code according to that.

Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>
---
 drivers/staging/rtl8723au/core/rtw_recv.c | 163 ++++++++++++++----------------
 1 file changed, 75 insertions(+), 88 deletions(-)

Patch
diff mbox

diff --git a/drivers/staging/rtl8723au/core/rtw_recv.c b/drivers/staging/rtl8723au/core/rtw_recv.c
index de98da5..29d4bc6 100644
--- a/drivers/staging/rtl8723au/core/rtw_recv.c
+++ b/drivers/staging/rtl8723au/core/rtw_recv.c
@@ -47,7 +47,7 @@  int _rtw_init_recv_priv23a(struct recv_priv *precvpriv,
 {
 	struct recv_frame *precvframe;
 	int i;
-	int res = _SUCCESS;
+	int res = 0;
 
 	spin_lock_init(&precvpriv->lock);
 
@@ -159,9 +159,7 @@  int rtw_free_recvframe23a(struct recv_frame *precvframe)
 
 	spin_unlock_bh(&pfree_recv_queue->lock);
 
-
-
-	return _SUCCESS;
+	return 0;
 }
 
 int rtw_enqueue_recvframe23a(struct recv_frame *precvframe, struct rtw_queue *queue)
@@ -182,7 +180,7 @@  int rtw_enqueue_recvframe23a(struct recv_frame *precvframe, struct rtw_queue *qu
 
 	spin_unlock_bh(&queue->lock);
 
-	return _SUCCESS;
+	return 0;
 }
 
 /*
@@ -234,7 +232,7 @@  int rtw_enqueue_recvbuf23a_to_head(struct recv_buf *precvbuf, struct rtw_queue *
 
 	spin_unlock_bh(&queue->lock);
 
-	return _SUCCESS;
+	return 0;
 }
 
 int rtw_enqueue_recvbuf23a(struct recv_buf *precvbuf, struct rtw_queue *queue)
@@ -247,7 +245,7 @@  int rtw_enqueue_recvbuf23a(struct recv_buf *precvbuf, struct rtw_queue *queue)
 
 	list_add_tail(&precvbuf->list, get_list_head(queue));
 	spin_unlock_irqrestore(&queue->lock, irqL);
-	return _SUCCESS;
+	return 0;
 }
 
 struct recv_buf *rtw_dequeue_recvbuf23a (struct rtw_queue *queue)
@@ -280,7 +278,7 @@  int recvframe_chkmic(struct rtw_adapter *adapter,
 int recvframe_chkmic(struct rtw_adapter *adapter,
 		     struct recv_frame *precvframe) {
 
-	int	i, res = _SUCCESS;
+	int	i, res = 0;
 	u32	datalen;
 	u8	miccode[8];
 	u8	bmic_err = false, brpt_micerror = true;
@@ -315,7 +313,7 @@  int recvframe_chkmic(struct rtw_adapter *adapter,
 					 ("\n recvframe_chkmic: bcmc key\n"));
 
 				if (!psecuritypriv->binstallGrpkey) {
-					res = _FAIL;
+					res = -EINVAL;
 					RT_TRACE(_module_rtl871x_recv_c_,
 						 _drv_err_,
 						 ("\n recvframe_chkmic:didn't "
@@ -441,7 +439,7 @@  int recvframe_chkmic(struct rtw_adapter *adapter,
 						  prxattrib->bdecrypted);
 				}
 
-				res = _FAIL;
+				res = -EINVAL;
 			} else {
 				/* mic checked ok */
 				if (!psecuritypriv->bcheck_grpkey &&
@@ -463,9 +461,6 @@  int recvframe_chkmic(struct rtw_adapter *adapter,
 	}
 
 exit:
-
-
-
 	return res;
 }
 
@@ -478,7 +473,7 @@  struct recv_frame *decryptor(struct rtw_adapter *padapter,
 	struct rx_pkt_attrib *prxattrib = &precv_frame->attrib;
 	struct security_priv *psecuritypriv = &padapter->securitypriv;
 	struct recv_frame *return_packet = precv_frame;
-	int res = _SUCCESS;
+	int res = 0;
 
 	RT_TRACE(_module_rtl871x_recv_c_, _drv_info_,
 		 ("prxstat->decrypted =%x prxattrib->encrypt = 0x%03x\n",
@@ -531,13 +526,11 @@  struct recv_frame *decryptor(struct rtw_adapter *padapter,
 			psecuritypriv->hw_decrypted = 1;
 	}
 
-	if (res == _FAIL) {
+	if (res < 0) {
 		rtw_free_recvframe23a(return_packet);
 		return_packet = NULL;
 	}
 
-
-
 	return return_packet;
 }
 
@@ -636,14 +629,12 @@  int recv_decache(struct recv_frame *precv_frame, u8 bretry,
 	u16 seq_ctrl = ((precv_frame->attrib.seq_num & 0xffff) << 4) |
 		(precv_frame->attrib.frag_num & 0xf);
 
-
-
 	if (tid > 15) {
 		RT_TRACE(_module_rtl871x_recv_c_, _drv_notice_,
 			 ("recv_decache, (tid>15)! seq_ctrl = 0x%x, tid = 0x%x\n",
 			  seq_ctrl, tid));
 
-		return _FAIL;
+		return -EINVAL;
 	}
 
 	if (1) { /* if (bretry) */
@@ -653,15 +644,13 @@  int recv_decache(struct recv_frame *precv_frame, u8 bretry,
 				  "tid_rxseq = 0x%x\n",
 				  seq_ctrl, tid, prxcache->tid_rxseq[tid]));
 
-			return _FAIL;
+			return -EINVAL;
 		}
 	}
 
 	prxcache->tid_rxseq[tid] = seq_ctrl;
 
-
-
-	return _SUCCESS;
+	return 0;
 }
 
 void process23a_pwrbit_data(struct rtw_adapter *padapter,
@@ -792,7 +781,7 @@  static int sta2sta_data_frame(struct rtw_adapter *adapter,
 {
 	struct sk_buff *skb = precv_frame->pkt;
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
-	int ret = _SUCCESS;
+	int ret = 0;
 	struct rx_pkt_attrib *pattrib = & precv_frame->attrib;
 	struct sta_priv *pstapriv = &adapter->stapriv;
 	struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
@@ -810,19 +799,19 @@  static int sta2sta_data_frame(struct rtw_adapter *adapter,
 		if (ether_addr_equal(myhwaddr, pattrib->src)) {
 			RT_TRACE(_module_rtl871x_recv_c_, _drv_err_,
 				 (" SA == myself\n"));
-			ret = _FAIL;
+			ret = -EINVAL;
 			goto exit;
 		}
 
 		if (!ether_addr_equal(myhwaddr, pattrib->dst) && !bmcast) {
-			ret = _FAIL;
+			ret = -EINVAL;
 			goto exit;
 		}
 
 		if (ether_addr_equal(pattrib->bssid, "\x0\x0\x0\x0\x0\x0") ||
 		    ether_addr_equal(mybssid, "\x0\x0\x0\x0\x0\x0") ||
 		    !ether_addr_equal(pattrib->bssid, mybssid)) {
-			ret = _FAIL;
+			ret = -EINVAL;
 			goto exit;
 		}
 
@@ -834,7 +823,7 @@  static int sta2sta_data_frame(struct rtw_adapter *adapter,
 			RT_TRACE(_module_rtl871x_recv_c_, _drv_err_,
 				 ("bssid != TA under STATION_MODE; drop "
 				  "pkt\n"));
-			ret = _FAIL;
+			ret = -EINVAL;
 			goto exit;
 		}
 
@@ -844,14 +833,14 @@  static int sta2sta_data_frame(struct rtw_adapter *adapter,
 		if (bmcast) {
 			/*  For AP mode, if DA == MCAST, then BSSID should be also MCAST */
 			if (!is_multicast_ether_addr(pattrib->bssid)) {
-				ret = _FAIL;
+				ret = -EINVAL;
 				goto exit;
 			}
 		} else { /*  not mc-frame */
 			/*  For AP mode, if DA is non-MCAST, then it must
 			    be BSSID, and bssid == BSSID */
 			if (!ether_addr_equal(pattrib->bssid, pattrib->dst)) {
-				ret = _FAIL;
+				ret = -EINVAL;
 				goto exit;
 			}
 
@@ -866,7 +855,7 @@  static int sta2sta_data_frame(struct rtw_adapter *adapter,
 
 		sta_addr = mybssid;
 	} else {
-		ret  = _FAIL;
+		ret  = -EINVAL;
 	}
 
 	if (bmcast)
@@ -876,7 +865,7 @@  static int sta2sta_data_frame(struct rtw_adapter *adapter,
 
 	if (*psta == NULL) {
 		RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("can't get psta under sta2sta_data_frame ; drop pkt\n"));
-		ret = _FAIL;
+		ret = -EINVAL;
 		goto exit;
 	}
 
@@ -895,7 +884,7 @@  int ap2sta_data_frame(struct rtw_adapter *adapter,
 	struct sk_buff *skb = precv_frame->pkt;
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
 	struct rx_pkt_attrib *pattrib = & precv_frame->attrib;
-	int ret = _SUCCESS;
+	int ret = 0;
 	struct sta_priv *pstapriv = &adapter->stapriv;
 	struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
 	u8 *mybssid  = get_bssid(pmlmepriv);
@@ -912,7 +901,7 @@  int ap2sta_data_frame(struct rtw_adapter *adapter,
 		if (ether_addr_equal(myhwaddr, pattrib->src)) {
 			RT_TRACE(_module_rtl871x_recv_c_, _drv_err_,
 				 (" SA == myself\n"));
-			ret = _FAIL;
+			ret = -EINVAL;
 			goto exit;
 		}
 
@@ -921,7 +910,7 @@  int ap2sta_data_frame(struct rtw_adapter *adapter,
 			RT_TRACE(_module_rtl871x_recv_c_, _drv_info_,
 				(" ap2sta_data_frame:  compare DA fail; DA ="
 				 MAC_FMT"\n", MAC_ARG(pattrib->dst)));
-			ret = _FAIL;
+			ret = -EINVAL;
 			goto exit;
 		}
 
@@ -943,7 +932,7 @@  int ap2sta_data_frame(struct rtw_adapter *adapter,
 					     WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA);
 			}
 
-			ret = _FAIL;
+			ret = -EINVAL;
 			goto exit;
 		}
 
@@ -957,7 +946,7 @@  int ap2sta_data_frame(struct rtw_adapter *adapter,
 			RT_TRACE(_module_rtl871x_recv_c_, _drv_err_,
 				 ("ap2sta: can't get psta under STATION_MODE ;"
 				  " drop pkt\n"));
-			ret = _FAIL;
+			ret = -EINVAL;
 			goto exit;
 		}
 
@@ -985,7 +974,7 @@  int ap2sta_data_frame(struct rtw_adapter *adapter,
 		if (*psta == NULL) {
 			RT_TRACE(_module_rtl871x_recv_c_, _drv_err_,
 				 ("can't get psta under MP_MODE ; drop pkt\n"));
-			ret = _FAIL;
+			ret = -EINVAL;
 			goto exit;
 		}
 	} else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
@@ -1005,7 +994,7 @@  int ap2sta_data_frame(struct rtw_adapter *adapter,
 			}
 		}
 
-		ret = _FAIL;
+		ret = -EINVAL;
 	}
 
 exit:
@@ -1028,14 +1017,14 @@  int sta2ap_data_frame(struct rtw_adapter *adapter,
 	struct sta_priv *pstapriv = &adapter->stapriv;
 	struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
 	unsigned char *mybssid = get_bssid(pmlmepriv);
-	int ret = _SUCCESS;
+	int ret = 0;
 
 
 
 	if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
 		/* For AP mode, RA = BSSID, TX = STA(SRC_ADDR), A3 = DST_ADDR */
 		if (!ether_addr_equal(pattrib->bssid, mybssid)) {
-			ret = _FAIL;
+			ret = -EINVAL;
 			goto exit;
 		}
 
@@ -1100,11 +1089,11 @@  static int validate_recv_ctrl_frame(struct rtw_adapter *padapter,
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
 
 	if (!ieee80211_is_ctl(hdr->frame_control))
-		return _FAIL;
+		return -EINVAL;
 
 	/* receive the frames that ra(a1) is my address */
 	if (!ether_addr_equal(hdr->addr1, myid(&padapter->eeprompriv)))
-		return _FAIL;
+		return -EINVAL;
 
 	/* only handle ps-poll */
 	if (ieee80211_is_pspoll(hdr->frame_control)) {
@@ -1117,7 +1106,7 @@  static int validate_recv_ctrl_frame(struct rtw_adapter *padapter,
 		psta = rtw_get_stainfo23a(pstapriv, hdr->addr2);
 
 		if (!psta || psta->aid != aid)
-			return _FAIL;
+			return -EINVAL;
 
 		/* for rx pkt statistics */
 		psta->sta_stats.rx_ctrl_pkts++;
@@ -1143,7 +1132,7 @@  static int validate_recv_ctrl_frame(struct rtw_adapter *padapter,
 		}
 
 		if (wmmps_ac)
-			return _FAIL;
+			return -EINVAL;
 
 		if (psta->state & WIFI_STA_ALIVE_CHK_STATE) {
 			DBG_8723A("%s alive check-rx ps-poll\n", __func__);
@@ -1232,7 +1221,7 @@  static int validate_recv_ctrl_frame(struct rtw_adapter *padapter,
 	}
 
 #endif
-	return _FAIL;
+	return -EINVAL;
 }
 
 struct recv_frame *recvframe_chk_defrag23a(struct rtw_adapter *padapter,
@@ -1252,7 +1241,7 @@  static int validate_recv_mgnt_frame(struct rtw_adapter *padapter,
 	if (precv_frame == NULL) {
 		RT_TRACE(_module_rtl871x_recv_c_, _drv_notice_,
 			 ("%s: fragment packet\n", __func__));
-		return _SUCCESS;
+		return 0;
 	}
 
 	skb = precv_frame->pkt;
@@ -1281,7 +1270,7 @@  static int validate_recv_mgnt_frame(struct rtw_adapter *padapter,
 
 	mgt_dispatcher23a(padapter, precv_frame);
 
-	return _SUCCESS;
+	return 0;
 }
 
 static int validate_recv_data_frame(struct rtw_adapter *adapter,
@@ -1292,7 +1281,7 @@  static int validate_recv_data_frame(struct rtw_adapter *adapter,
 	struct sta_info *psta = NULL;
 	struct rx_pkt_attrib *pattrib = & precv_frame->attrib;
 	struct security_priv *psecuritypriv = &adapter->securitypriv;
-	int ret = _SUCCESS;
+	int ret = 0;
 	struct sk_buff *skb = precv_frame->pkt;
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
 
@@ -1336,18 +1325,18 @@  static int validate_recv_data_frame(struct rtw_adapter *adapter,
 		ether_addr_copy(pattrib->bssid, hdr->addr1);
 		ether_addr_copy(pattrib->ra, hdr->addr1);
 		ether_addr_copy(pattrib->ta, hdr->addr2);
-		ret = _FAIL;
+		ret = -EINVAL;
 		RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, (" case 3\n"));
 		break;
 	}
 
-	if ((ret == _FAIL) || (ret == RTW_RX_HANDLED))
+	if ((ret < 0) || (ret == RTW_RX_HANDLED))
 		goto exit;
 
 	if (!psta) {
 		RT_TRACE(_module_rtl871x_recv_c_, _drv_err_,
 			 (" after to_fr_ds_chk; psta == NULL\n"));
-		ret = _FAIL;
+		ret = -EINVAL;
 		goto exit;
 	}
 
@@ -1386,11 +1375,10 @@  static int validate_recv_data_frame(struct rtw_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) {
+	if (recv_decache(precv_frame, bretry, &psta->sta_recvpriv.rxcache) < 0) {
 		RT_TRACE(_module_rtl871x_recv_c_, _drv_err_,
 			 ("decache : drop pkt\n"));
-		ret = _FAIL;
+		ret = -EINVAL;
 		goto exit;
 	}
 
@@ -1473,7 +1461,7 @@  static int validate_recv_frame(struct rtw_adapter *adapter,
 	/* then call check if rx seq/frag. duplicated. */
 	u8 type;
 	u8 subtype;
-	int retval = _SUCCESS;
+	int retval = 0;
 	struct rx_pkt_attrib *pattrib = & precv_frame->attrib;
 	struct sk_buff *skb = precv_frame->pkt;
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
@@ -1490,7 +1478,7 @@  static int validate_recv_frame(struct rtw_adapter *adapter,
 	if (ver != 0) {
 		RT_TRACE(_module_rtl871x_recv_c_, _drv_err_,
 			 ("validate_recv_data_frame fail! (ver!= 0)\n"));
-		retval = _FAIL;
+		retval = -EINVAL;
 		goto exit;
 	}
 
@@ -1512,25 +1500,25 @@  static int validate_recv_frame(struct rtw_adapter *adapter,
 	switch (type) {
 	case IEEE80211_FTYPE_MGMT:
 		retval = validate_recv_mgnt_frame(adapter, precv_frame);
-		if (retval == _FAIL) {
+		if (retval < 0) {
 			RT_TRACE(_module_rtl871x_recv_c_, _drv_err_,
 				 ("validate_recv_mgnt_frame fail\n"));
 		}
-		retval = _FAIL; /*  only data frame return _SUCCESS */
+		retval = -EINVAL; /*  only data frame return _SUCCESS */
 		break;
 	case IEEE80211_FTYPE_CTL:
 		retval = validate_recv_ctrl_frame(adapter, precv_frame);
-		if (retval == _FAIL) {
+		if (retval < 0) {
 			RT_TRACE(_module_rtl871x_recv_c_, _drv_err_,
 				 ("validate_recv_ctrl_frame fail\n"));
 		}
-		retval = _FAIL; /*  only data frame return _SUCCESS */
+		retval = -EINVAL; /*  only data frame return _SUCCESS */
 		break;
 	case IEEE80211_FTYPE_DATA:
 		rtw_led_control(adapter, LED_CTL_RX);
 		pattrib->qos = (subtype & IEEE80211_STYPE_QOS_DATA) ? 1 : 0;
 		retval = validate_recv_data_frame(adapter, precv_frame);
-		if (retval == _FAIL) {
+		if (retval < 0) {
 			struct recv_priv *precvpriv = &adapter->recvpriv;
 			/* RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("validate_recv_data_frame fail\n")); */
 			precvpriv->rx_drop++;
@@ -1539,7 +1527,7 @@  static int validate_recv_frame(struct rtw_adapter *adapter,
 	default:
 		RT_TRACE(_module_rtl871x_recv_c_, _drv_err_,
 			 ("validate_recv_data_frame fail! type = 0x%x\n", type));
-		retval = _FAIL;
+		retval = -EINVAL;
 		break;
 	}
 
@@ -1614,7 +1602,7 @@  static int wlanhdr_to_ethhdr (struct recv_frame *precvframe)
 	}
 
 
-	return _SUCCESS;
+	return 0;
 }
 
 /* perform defrag */
@@ -1814,7 +1802,7 @@  struct recv_frame *recvframe_chk_defrag23a(struct rtw_adapter *padapter,
 
 	if ((prtnframe != NULL) && (prtnframe->attrib.privacy))	{
 		/* after defrag we must check tkip mic code */
-		if (recvframe_chkmic(padapter,  prtnframe) == _FAIL) {
+		if (recvframe_chkmic(padapter,  prtnframe) < 0) {
 			RT_TRACE(_module_rtl871x_recv_c_, _drv_err_,
 				 ("recvframe_chkmic(padapter,  prtnframe) =="
 				  "_FAIL\n"));
@@ -1856,7 +1844,7 @@  int amsdu_to_msdu(struct rtw_adapter *padapter, struct recv_frame *prframe)
 
 	prframe->pkt = NULL;
 	rtw_free_recvframe23a(prframe);
-	return _SUCCESS;
+	return 0;
 }
 
 int check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_num);
@@ -2009,8 +1997,7 @@  int recv_indicatepkts_in_order(struct rtw_adapter *padapter,
 					rtw_recv_indicatepkt23a(padapter, prframe);
 				}
 			} else {
-				if (amsdu_to_msdu(padapter, prframe) !=
-				    _SUCCESS)
+				if (amsdu_to_msdu(padapter, prframe) != 0)
 					rtw_free_recvframe23a(prframe);
 			}
 
@@ -2036,7 +2023,7 @@  int recv_indicatepkt_reorder(struct rtw_adapter *padapter,
 int recv_indicatepkt_reorder(struct rtw_adapter *padapter,
 			     struct recv_frame *prframe)
 {
-	int retval = _SUCCESS;
+	int retval = 0;
 	struct rx_pkt_attrib *pattrib;
 	struct recv_reorder_ctrl *preorder_ctrl;
 	struct rtw_queue *ppending_recvframe_queue;
@@ -2058,10 +2045,10 @@  int recv_indicatepkt_reorder(struct rtw_adapter *padapter,
 					  "recv_func recv_indicatepkt\n"));
 
 				rtw_recv_indicatepkt23a(padapter, prframe);
-				return _SUCCESS;
+				return 0;
 			}
 
-			return _FAIL;
+			return -EINVAL;
 		}
 
 		if (preorder_ctrl->enable == false) {
@@ -2071,7 +2058,7 @@  int recv_indicatepkt_reorder(struct rtw_adapter *padapter,
 
 			preorder_ctrl->indicate_seq =
 				(preorder_ctrl->indicate_seq + 1) % 4096;
-			return _SUCCESS;
+			return 0;
 		}
 	} else {
 		 /* temp filter -> means didn't support A-MSDUs in a A-MPDU */
@@ -2122,12 +2109,12 @@  int recv_indicatepkt_reorder(struct rtw_adapter *padapter,
 		spin_unlock_bh(&ppending_recvframe_queue->lock);
 		del_timer_sync(&preorder_ctrl->reordering_ctrl_timer);
 	}
-	return _SUCCESS;
+	return 0;
 
 _err_exit:
 
 	spin_unlock_bh(&ppending_recvframe_queue->lock);
-	return _FAIL;
+	return -EINVAL;
 }
 
 void rtw_reordering_ctrl_timeout_handler23a(unsigned long pcontext)
@@ -2161,7 +2148,7 @@  int process_recv_indicatepkts(struct rtw_adapter *padapter,
 int process_recv_indicatepkts(struct rtw_adapter *padapter,
 			      struct recv_frame *prframe)
 {
-	int retval = _SUCCESS;
+	int retval = 0;
 	/* struct recv_priv *precvpriv = &padapter->recvpriv; */
 	/* struct rx_pkt_attrib *pattrib = &prframe->attrib; */
 	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
@@ -2171,16 +2158,16 @@  int process_recv_indicatepkts(struct rtw_adapter *padapter,
 		/* prframe->preorder_ctrl = &precvpriv->recvreorder_ctrl[pattrib->priority]; */
 
 		/*  including perform A-MPDU Rx Ordering Buffer Control */
-		if (recv_indicatepkt_reorder(padapter, prframe) != _SUCCESS) {
+		if (recv_indicatepkt_reorder(padapter, prframe) != 0) {
 			if ((padapter->bDriverStopped == false) &&
 			    (padapter->bSurpriseRemoved == false)) {
-				retval = _FAIL;
+				retval = -EINVAL;
 				return retval;
 			}
 		}
 	} else { /* B/G mode */
 		retval = wlanhdr_to_ethhdr(prframe);
-		if (retval != _SUCCESS) {
+		if (retval != 0) {
 			RT_TRACE(_module_rtl871x_recv_c_, _drv_err_,
 				 ("wlanhdr_to_ethhdr: drop pkt\n"));
 			return retval;
@@ -2203,7 +2190,7 @@  int process_recv_indicatepkts(struct rtw_adapter *padapter,
 				  "bSurpriseRemoved(%d)",
 				  padapter->bDriverStopped,
 				  padapter->bSurpriseRemoved));
-			retval = _FAIL;
+			retval = -EINVAL;
 			return retval;
 		}
 
@@ -2215,11 +2202,11 @@  int process_recv_indicatepkts(struct rtw_adapter *padapter,
 static int recv_func_prehandle(struct rtw_adapter *padapter,
 			       struct recv_frame *rframe)
 {
-	int ret = _SUCCESS;
+	int ret = 0;
 
 	/* check the frame crtl field and decache */
 	ret = validate_recv_frame(padapter, rframe);
-	if (ret != _SUCCESS) {
+	if (ret != 0) {
 		RT_TRACE(_module_rtl871x_recv_c_, _drv_info_,
 			 ("recv_func: validate_recv_frame fail! drop pkt\n"));
 		rtw_free_recvframe23a(rframe);
@@ -2233,7 +2220,7 @@  exit:
 static int recv_func_posthandle(struct rtw_adapter *padapter,
 				struct recv_frame *prframe)
 {
-	int ret = _SUCCESS;
+	int ret = 0;
 	struct recv_frame *orig_prframe = prframe;
 	struct recv_priv *precvpriv = &padapter->recvpriv;
 
@@ -2244,7 +2231,7 @@  static int recv_func_posthandle(struct rtw_adapter *padapter,
 	if (prframe == NULL) {
 		RT_TRACE(_module_rtl871x_recv_c_, _drv_err_,
 			 ("decryptor: drop pkt\n"));
-		ret = _FAIL;
+		ret = -EINVAL;
 		goto _recv_data_drop;
 	}
 
@@ -2271,14 +2258,14 @@  static int recv_func_posthandle(struct rtw_adapter *padapter,
 	if (!prframe) {
 		RT_TRACE(_module_rtl871x_recv_c_, _drv_err_,
 			 ("portctrl: drop pkt\n"));
-		ret = _FAIL;
+		ret = -EINVAL;
 		goto _recv_data_drop;
 	}
 
 	count_rx_stats(padapter, prframe, NULL);
 
 	ret = process_recv_indicatepkts(padapter, prframe);
-	if (ret != _SUCCESS) {
+	if (ret != 0) {
 		RT_TRACE(_module_rtl871x_recv_c_, _drv_err_,
 			 ("recv_func: process_recv_indicatepkts fail!\n"));
 		rtw_free_recvframe23a(orig_prframe);/* free this recv_frame */
@@ -2307,14 +2294,14 @@  int rtw_recv_entry23a(struct recv_frame *rframe)
 
 		while ((pending_frame = rtw_alloc_recvframe23a(&padapter->recvpriv.uc_swdec_pending_queue))) {
 			r = recv_func_posthandle(padapter, pending_frame);
-			if (r == _SUCCESS)
+			if (r == 0)
 				DBG_8723A("%s: dequeue uc_swdec_pending_queue\n", __func__);
 		}
 	}
 
 	ret = recv_func_prehandle(padapter, rframe);
 
-	if (ret == _SUCCESS) {
+	if (ret == 0) {
 		/* check if need to enqueue into uc_swdec_pending_queue*/
 		if (check_fwstate(mlmepriv, WIFI_STATION_STATE) &&
 		    !is_multicast_ether_addr(prxattrib->ra) &&