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

Message ID 1414668396-4093-6-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_mlme.c | 40 +++++++++++++++----------------
 1 file changed, 20 insertions(+), 20 deletions(-)

Patch
diff mbox

diff --git a/drivers/staging/rtl8723au/core/rtw_mlme.c b/drivers/staging/rtl8723au/core/rtw_mlme.c
index 85d1eca..8a7d577 100644
--- a/drivers/staging/rtl8723au/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723au/core/rtw_mlme.c
@@ -67,7 +67,7 @@  int rtw_init_mlme_priv23a(struct rtw_adapter *padapter)
 	rtw_clear_scan_deny(padapter);
 
 	rtw_init_mlme_timer(padapter);
-	return _SUCCESS;
+	return 0;
 }
 
 #ifdef CONFIG_8723AU_AP_MODE
@@ -249,7 +249,7 @@  static void _rtw_roaming(struct rtw_adapter *padapter,
 
 		while (1) {
 			do_join_r = rtw_do_join(padapter);
-			if (do_join_r == _SUCCESS)
+			if (do_join_r == 0)
 				break;
 			else {
 				DBG_8723A("roaming do_join return %d\n",
@@ -680,13 +680,13 @@  rtw_surveydone_event_callback23a(struct rtw_adapter *adapter, const u8 *pbuf)
 		if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
 			ret = rtw_select_and_join_from_scanned_queue23a(
 				pmlmepriv);
-			if (ret != _SUCCESS)
+			if (ret != 0)
 				rtw_do_join_adhoc(adapter);
 		} else {
 			pmlmepriv->to_join = false;
 			ret = rtw_select_and_join_from_scanned_queue23a(
 				pmlmepriv);
-			if (ret != _SUCCESS) {
+			if (ret != 0) {
 				DBG_8723A("try_to_join, but select scanning "
 					  "queue fail, to_roaming:%d\n",
 					  adapter->mlmepriv.to_roaming);
@@ -695,7 +695,7 @@  rtw_surveydone_event_callback23a(struct rtw_adapter *adapter, const u8 *pbuf)
 					    rtw_sitesurvey_cmd23a(
 						    adapter,
 						    &pmlmepriv->assoc_ssid, 1,
-						    NULL, 0) != _SUCCESS) {
+						    NULL, 0) != 0) {
 						rtw_set_roaming(adapter, 0);
 						rtw_free_assoc_resources23a(
 							adapter, 1);
@@ -1432,7 +1432,7 @@  void rtw23a_join_to_handler (unsigned long data)
 				/* try another */
 				DBG_8723A("%s try another roaming\n", __func__);
 				do_join_r = rtw_do_join(adapter);
-				if (do_join_r != _SUCCESS) {
+				if (do_join_r != 0) {
 					DBG_8723A("%s roaming do_join return "
 						  "%d\n", __func__ , do_join_r);
 					continue;
@@ -1625,19 +1625,19 @@  static int rtw_do_join(struct rtw_adapter *padapter)
 	pmlmepriv->to_join = true;
 
 	ret = rtw_select_and_join_from_scanned_queue23a(pmlmepriv);
-	if (ret == _SUCCESS) {
+	if (ret == 0) {
 		pmlmepriv->to_join = false;
 	} else {
 		if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
 			/* switch to ADHOC_MASTER */
 			ret = rtw_do_join_adhoc(padapter);
-			if (ret != _SUCCESS)
+			if (ret != 0)
 				goto exit;
 		} else {
 			/*  can't associate ; reset under-linking */
 			_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
 
-			ret = _FAIL;
+			ret = -EOPNOTSUPP;
 			pmlmepriv->to_join = false;
 		}
 	}
@@ -1698,7 +1698,7 @@  int rtw_do_join_adhoc(struct rtw_adapter *adapter)
 	pmlmepriv->fw_state = WIFI_ADHOC_MASTER_STATE;
 
 	ret = rtw_createbss_cmd23a(adapter);
-	if (ret != _SUCCESS) {
+	if (ret != 0) {
 		RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
 			 ("Error =>rtw_createbss_cmd23a status FAIL\n"));
 	} else  {
@@ -1725,7 +1725,7 @@  int rtw_do_join_network(struct rtw_adapter *adapter,
 
 	ret = rtw_joinbss_cmd23a(adapter, candidate);
 
-	if (ret == _SUCCESS)
+	if (ret == 0)
 		mod_timer(&adapter->mlmepriv.assoc_timer,
 			  jiffies + msecs_to_jiffies(MAX_JOIN_TIMEOUT));
 
@@ -1743,7 +1743,7 @@  int rtw_select_and_join_from_scanned_queue23a(struct mlme_priv *pmlmepriv)
 	candidate = rtw_select_candidate_from_queue(pmlmepriv);
 	if (!candidate) {
 		DBG_8723A("%s: return _FAIL(candidate == NULL)\n", __func__);
-		ret = _FAIL;
+		ret = -EINVAL;
 		goto exit;
 	} else {
 		DBG_8723A("%s: candidate: %s("MAC_FMT", ch:%u)\n", __func__,
@@ -1764,18 +1764,18 @@  int rtw_set_auth23a(struct rtw_adapter *adapter,
 	struct cmd_obj *pcmd;
 	struct setauth_parm *psetauthparm;
 	struct cmd_priv *pcmdpriv = &adapter->cmdpriv;
-	int res = _SUCCESS;
+	int res = 0;
 
 	pcmd = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
 	if (!pcmd) {
-		res = _FAIL;  /* try again */
+		res = -ENOMEM;  /* try again */
 		goto exit;
 	}
 
 	psetauthparm = kzalloc(sizeof(struct setauth_parm), GFP_KERNEL);
 	if (!psetauthparm) {
 		kfree(pcmd);
-		res = _FAIL;
+		res = -ENOMEM;
 		goto exit;
 	}
 
@@ -1806,22 +1806,22 @@  int rtw_set_key23a(struct rtw_adapter *adapter,
 	struct setkey_parm *psetkeyparm;
 	struct cmd_priv *pcmdpriv = &adapter->cmdpriv;
 	struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
-	int res = _SUCCESS;
+	int res = 0;
 
 	if (keyid >= 4) {
-		res = _FAIL;
+		res = -EINVAL;
 		goto exit;
 	}
 
 	pcmd = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
 	if (!pcmd) {
-		res = _FAIL;  /* try again */
+		res = -ENOMEM;  /* try again */
 		goto exit;
 	}
 	psetkeyparm = kzalloc(sizeof(struct setkey_parm), GFP_KERNEL);
 	if (!psetkeyparm) {
 		kfree(pcmd);
-		res = _FAIL;
+		res = -ENOMEM;
 		goto exit;
 	}
 
@@ -1879,7 +1879,7 @@  int rtw_set_key23a(struct rtw_adapter *adapter,
 			 ("\n rtw_set_key23a:psecuritypriv->dot11PrivacyAlgrthm"
 			  " = %x (must be 1 or 2 or 4 or 5)\n",
 			  psecuritypriv->dot11PrivacyAlgrthm));
-		res = _FAIL;
+		res = -EINVAL;
 		kfree(pcmd);
 		kfree(psetkeyparm);
 		goto exit;