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

Message ID 1414668396-4093-10-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_security.c | 42 +++++++++++++--------------
 1 file changed, 21 insertions(+), 21 deletions(-)

Patch
diff mbox

diff --git a/drivers/staging/rtl8723au/core/rtw_security.c b/drivers/staging/rtl8723au/core/rtw_security.c
index 715a474..a1131f9 100644
--- a/drivers/staging/rtl8723au/core/rtw_security.c
+++ b/drivers/staging/rtl8723au/core/rtw_security.c
@@ -619,10 +619,10 @@  int rtw_tkip_encrypt23a(struct rtw_adapter *padapter,
 	struct	pkt_attrib	 *pattrib = &pxmitframe->attrib;
 	struct	security_priv	*psecuritypriv = &padapter->securitypriv;
 	struct	xmit_priv		*pxmitpriv = &padapter->xmitpriv;
-	int res = _SUCCESS;
+	int res = 0;
 
 	if (!pxmitframe->buf_addr)
-		return _FAIL;
+		return -EFAULT;
 
 	hw_hdr_offset = TXDESC_OFFSET;
 
@@ -641,7 +641,7 @@  int rtw_tkip_encrypt23a(struct rtw_adapter *padapter,
 
 			if (!(stainfo->state &_FW_LINKED)) {
 				DBG_8723A("%s, psta->state(0x%x) != _FW_LINKED\n", __func__, stainfo->state);
-				return _FAIL;
+				return -EINVAL;
 			}
 
 			RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("rtw_tkip_encrypt23a: stainfo!= NULL!!!\n"));
@@ -692,7 +692,7 @@  int rtw_tkip_encrypt23a(struct rtw_adapter *padapter,
 		else{
 			RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("rtw_tkip_encrypt23a: stainfo == NULL!!!\n"));
 			DBG_8723A("%s, psta == NUL\n", __func__);
-			res = _FAIL;
+			res = -EINVAL;
 		}
 
 	}
@@ -718,7 +718,7 @@  int rtw_tkip_decrypt23a(struct rtw_adapter *padapter,
 	struct	rx_pkt_attrib *prxattrib = &precvframe->attrib;
 	struct	security_priv *psecuritypriv = &padapter->securitypriv;
 	struct sk_buff *skb = precvframe->pkt;
-	int res = _SUCCESS;
+	int res = 0;
 
 	pframe = skb->data;
 
@@ -731,7 +731,7 @@  int rtw_tkip_decrypt23a(struct rtw_adapter *padapter,
 
 			if (is_multicast_ether_addr(prxattrib->ra)) {
 				if (psecuritypriv->binstallGrpkey == 0) {
-					res = _FAIL;
+					res = -EINVAL;
 					DBG_8723A("%s:rx bc/mc packets, but didn't install group key!!!!!!!!!!\n", __func__);
 					goto exit;
 				}
@@ -765,11 +765,11 @@  int rtw_tkip_decrypt23a(struct rtw_adapter *padapter,
 			{
 			    RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("rtw_wep_decrypt23a:icv error crc[3](%x)!= payload[length-1](%x) || crc[2](%x)!= payload[length-2](%x) || crc[1](%x)!= payload[length-3](%x) || crc[0](%x)!= payload[length-4](%x)\n",
 						crc[3], payload[length-1], crc[2], payload[length-2], crc[1], payload[length-3], crc[0], payload[length-4]));
-				res = _FAIL;
+				res = -EINVAL;
 			}
 		} else {
 			RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("rtw_tkip_decrypt23a: stainfo == NULL!!!\n"));
-			res = _FAIL;
+			res = -EINVAL;
 		}
 	}
 exit:
@@ -1267,7 +1267,7 @@  static int aes_cipher(u8 *key, uint hdrlen, u8 *pframe, uint plen)
 	for (j = 0; j < 8;j++)
 		pframe[payload_index++] = chain_buffer[j];
 
-	return _SUCCESS;
+	return 0;
 }
 
 int rtw_aes_encrypt23a(struct rtw_adapter *padapter,
@@ -1282,10 +1282,10 @@  int rtw_aes_encrypt23a(struct rtw_adapter *padapter,
 	struct pkt_attrib *pattrib = &pxmitframe->attrib;
 	struct security_priv *psecuritypriv = &padapter->securitypriv;
 	struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
-	int res = _SUCCESS;
+	int res = 0;
 
 	if (!pxmitframe->buf_addr)
-		return _FAIL;
+		return -EFAULT;
 
 	hw_hdr_offset = TXDESC_OFFSET;
 
@@ -1293,7 +1293,7 @@  int rtw_aes_encrypt23a(struct rtw_adapter *padapter,
 
 	/* 4 start to encrypt each fragment */
 	if (pattrib->encrypt != WLAN_CIPHER_SUITE_CCMP)
-		return _FAIL;
+		return -EINVAL;
 
 	if (pattrib->psta) {
 		stainfo = pattrib->psta;
@@ -1306,13 +1306,13 @@  int rtw_aes_encrypt23a(struct rtw_adapter *padapter,
 		RT_TRACE(_module_rtl871x_security_c_, _drv_err_,
 			 ("rtw_aes_encrypt23a: stainfo == NULL!!!\n"));
 		DBG_8723A("%s, psta == NUL\n", __func__);
-		res = _FAIL;
+		res = -EINVAL;
 		goto out;
 	}
 	if (!(stainfo->state &_FW_LINKED)) {
 		DBG_8723A("%s, psta->state(0x%x) != _FW_LINKED\n",
 			  __func__, stainfo->state);
-		return _FAIL;
+		return -EINVAL;
 	}
 	RT_TRACE(_module_rtl871x_security_c_, _drv_err_,
 		 ("rtw_aes_encrypt23a: stainfo!= NULL!!!\n"));
@@ -1351,7 +1351,7 @@  static int aes_decipher(u8 *key, uint	hdrlen,
 	static u8	message[MAX_MSG_SIZE];
 	uint	qc_exists, a4_exists, i, j, payload_remainder,
 			num_blocks, payload_index;
-	int res = _SUCCESS;
+	int res = 0;
 	u8 pn_vector[6];
 	u8 mic_iv[16];
 	u8 mic_header1[16];
@@ -1548,7 +1548,7 @@  static int aes_decipher(u8 *key, uint	hdrlen,
 				 i, pframe[hdrlen+8+plen-8+i], message[hdrlen+8+plen-8+i]));
 			DBG_8723A("aes_decipher:mic check error mic[%d]: pframe(%x) != message(%x)\n",
 				  i, pframe[hdrlen+8+plen-8+i], message[hdrlen+8+plen-8+i]);
-			res = _FAIL;
+			res = -EINVAL;
 		}
 	}
 	return res;
@@ -1563,18 +1563,18 @@  int rtw_aes_decrypt23a(struct rtw_adapter *padapter,
 	struct sk_buff *skb = precvframe->pkt;
 	int length;
 	u8 *pframe, *prwskey;	/*  *payload,*iv */
-	int res = _SUCCESS;
+	int res = 0;
 
 	pframe = skb->data;
 	/* 4 start to encrypt each fragment */
 	if (prxattrib->encrypt != WLAN_CIPHER_SUITE_CCMP)
-		return _FAIL;
+		return -EINVAL;
 
 	stainfo = rtw_get_stainfo23a(&padapter->stapriv, &prxattrib->ta[0]);
 	if (!stainfo) {
 		RT_TRACE(_module_rtl871x_security_c_, _drv_err_,
 			 ("rtw_aes_encrypt23a: stainfo == NULL!!!\n"));
-		res = _FAIL;
+		res = -EINVAL;
 		goto exit;
 	}
 
@@ -1585,7 +1585,7 @@  int rtw_aes_decrypt23a(struct rtw_adapter *padapter,
 		/* in concurrent we should use sw decrypt in group key,
 		   so we remove this message */
 		if (!psecuritypriv->binstallGrpkey) {
-			res = _FAIL;
+			res = -EINVAL;
 			DBG_8723A("%s:rx bc/mc packets, but didn't install "
 				  "group key!!!!!!!!!!\n", __func__);
 			goto exit;
@@ -1595,7 +1595,7 @@  int rtw_aes_decrypt23a(struct rtw_adapter *padapter,
 			DBG_8723A("not match packet_index =%d, install_index ="
 				  "%d\n", prxattrib->key_index,
 				  psecuritypriv->dot118021XGrpKeyid);
-			res = _FAIL;
+			res = -EINVAL;
 			goto exit;
 		}
 	} else {