[OPW,kernel,v3,23/28] staging: rtl8723au: os_dep: os_intfs.c: Replace non-standard return values
diff mbox

Message ID 1414668396-4093-24-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/os_dep/os_intfs.c | 64 ++++++++++++++---------------
 1 file changed, 32 insertions(+), 32 deletions(-)

Patch
diff mbox

diff --git a/drivers/staging/rtl8723au/os_dep/os_intfs.c b/drivers/staging/rtl8723au/os_dep/os_intfs.c
index d001003..82dd7aa 100644
--- a/drivers/staging/rtl8723au/os_dep/os_intfs.c
+++ b/drivers/staging/rtl8723au/os_dep/os_intfs.c
@@ -233,7 +233,7 @@  static int loadparam(struct rtw_adapter *padapter,  struct net_device *pnetdev)
 	snprintf(registry_par->if2name, 16, "%s", if2name);
 	registry_par->notch_filter = (u8)rtw_notch_filter;
 	registry_par->regulatory_tid = (u8)rtw_regulatory_id;
-	return _SUCCESS;
+	return 0;
 }
 
 static int rtw_net_set_mac_address(struct net_device *pnetdev, void *p)
@@ -421,7 +421,7 @@  static int rtw_init_default_value(struct rtw_adapter *padapter)
 	/* misc. */
 	padapter->bReadPortCancel = false;
 	padapter->bWritePortCancel = false;
-	return _SUCCESS;
+	return 0;
 }
 
 int rtw_reset_drv_sw23a(struct rtw_adapter *padapter)
@@ -449,61 +449,61 @@  int rtw_reset_drv_sw23a(struct rtw_adapter *padapter)
 	padapter->mlmeextpriv.sitesurvey_res.state = SCAN_DISABLE;
 
 	rtw_set_signal_stat_timer(&padapter->recvpriv);
-	return _SUCCESS;
+	return 0;
 }
 
 int rtw_init_drv_sw23a(struct rtw_adapter *padapter)
 {
-	int ret8 = _SUCCESS;
+	int ret8 = 0;
 
 	RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+rtw_init_drv_sw23a\n"));
 
-	if (rtw_init_cmd_priv23a(&padapter->cmdpriv) == _FAIL) {
+	if (rtw_init_cmd_priv23a(&padapter->cmdpriv) < 0) {
 		RT_TRACE(_module_os_intfs_c_, _drv_err_,
 			 ("\n Can't init cmd_priv\n"));
-		ret8 = _FAIL;
+		ret8 = -EINVAL;
 		goto exit;
 	}
 
 	padapter->cmdpriv.padapter = padapter;
 
-	if (rtw_init_evt_priv23a(&padapter->evtpriv) == _FAIL) {
+	if (rtw_init_evt_priv23a(&padapter->evtpriv) < 0) {
 		RT_TRACE(_module_os_intfs_c_, _drv_err_,
 			 ("\n Can't init evt_priv\n"));
-		ret8 = _FAIL;
+		ret8 = -EINVAL;
 		goto exit;
 	}
 
-	if (rtw_init_mlme_priv23a(padapter) == _FAIL) {
+	if (rtw_init_mlme_priv23a(padapter) < 0) {
 		RT_TRACE(_module_os_intfs_c_, _drv_err_,
 			 ("\n Can't init mlme_priv\n"));
-		ret8 = _FAIL;
+		ret8 = -EINVAL;
 		goto exit;
 	}
 
 
-	if (init_mlme_ext_priv23a(padapter) == _FAIL) {
+	if (init_mlme_ext_priv23a(padapter) < 0) {
 		RT_TRACE(_module_os_intfs_c_, _drv_err_,
 			 ("\n Can't init mlme_ext_priv\n"));
-		ret8 = _FAIL;
+		ret8 = -EINVAL;
 		goto exit;
 	}
 
-	if (_rtw_init_xmit_priv23a(&padapter->xmitpriv, padapter) == _FAIL) {
+	if (_rtw_init_xmit_priv23a(&padapter->xmitpriv, padapter) < 0) {
 		DBG_8723A("Can't _rtw_init_xmit_priv23a\n");
-		ret8 = _FAIL;
+		ret8 = -EINVAL;
 		goto exit;
 	}
 
-	if (_rtw_init_recv_priv23a(&padapter->recvpriv, padapter) == _FAIL) {
+	if (_rtw_init_recv_priv23a(&padapter->recvpriv, padapter) < 0) {
 		DBG_8723A("Can't _rtw_init_recv_priv23a\n");
-		ret8 = _FAIL;
+		ret8 = -EINVAL;
 		goto exit;
 	}
 
-	if (_rtw_init_sta_priv23a(&padapter->stapriv) == _FAIL) {
+	if (_rtw_init_sta_priv23a(&padapter->stapriv) < 0) {
 		DBG_8723A("Can't _rtw_init_sta_priv23a\n");
-		ret8 = _FAIL;
+		ret8 = -EINVAL;
 		goto exit;
 	}
 
@@ -578,13 +578,13 @@  int rtw_free_drv_sw23a(struct rtw_adapter *padapter)
 	padapter->HalData = NULL;
 
 	RT_TRACE(_module_os_intfs_c_, _drv_info_, ("-rtw_free_drv_sw23a\n"));
-	return _SUCCESS;
+	return 0;
 }
 
 static int _rtw_drv_register_netdev(struct rtw_adapter *padapter, char *name)
 {
 	struct net_device *pnetdev = padapter->pnetdev;
-	int ret = _SUCCESS;
+	int ret = 0;
 
 	/* alloc netdev name */
 	rtw_init_netdev23a_name23a(pnetdev, name);
@@ -594,7 +594,7 @@  static int _rtw_drv_register_netdev(struct rtw_adapter *padapter, char *name)
 	/* Tell the network stack we exist */
 	if (register_netdev(pnetdev)) {
 		DBG_8723A("%s(%s): Failed!\n", __func__, pnetdev->name);
-		ret = _FAIL;
+		ret = -EINVAL;
 		goto error_register_netdev;
 	}
 	DBG_8723A("%s, MAC Address (if%d) = " MAC_FMT "\n", __func__,
@@ -614,10 +614,10 @@  error_register_netdev:
 int rtw_drv_register_netdev(struct rtw_adapter *if1)
 {
 	struct dvobj_priv *dvobj = if1->dvobj;
-	int i, status = _SUCCESS;
+	int i, status = 0;
 
 	if (dvobj->iface_nums >= IFACE_ID_MAX) {
-		status = _FAIL; /* -EINVAL */
+		status = -EINVAL;
 		goto exit;
 	}
 
@@ -634,7 +634,7 @@  int rtw_drv_register_netdev(struct rtw_adapter *if1)
 			else
 				name = "wlan%d";
 			status = _rtw_drv_register_netdev(padapter, name);
-			if (status != _SUCCESS)
+			if (status != 0)
 				break;
 		}
 	}
@@ -663,7 +663,7 @@  int netdev_open23a(struct net_device *pnetdev)
 		padapter->bCardDisableWOHSM = false;
 
 		status = rtl8723au_hal_init(padapter);
-		if (status == _FAIL) {
+		if (status < 0) {
 			RT_TRACE(_module_os_intfs_c_, _drv_err_,
 				 ("rtl871x_hal_init(): Can't init h/w!\n"));
 			goto netdev_open23a_error;
@@ -672,7 +672,7 @@  int netdev_open23a(struct net_device *pnetdev)
 		DBG_8723A("MAC Address = "MAC_FMT"\n",
 			  MAC_ARG(pnetdev->dev_addr));
 
-		if (init_hw_mlme_ext23a(padapter) == _FAIL) {
+		if (init_hw_mlme_ext23a(padapter) < 0) {
 			DBG_8723A("can't init mlme_ext_priv\n");
 			goto netdev_open23a_error;
 		}
@@ -716,13 +716,13 @@  netdev_open23a_error:
 		 ("-871x_drv - dev_open, fail!\n"));
 	DBG_8723A("-871x_drv - drv_open fail, bup =%d\n", padapter->bup);
 
-	ret = -1;
+	ret = -EPERM;
 	goto exit;
 }
 
 static int ips_netdrv_open(struct rtw_adapter *padapter)
 {
-	int status = _SUCCESS;
+	int status = 0;
 
 	padapter->net_closed = false;
 	DBG_8723A("===> %s.........\n", __func__);
@@ -732,7 +732,7 @@  static int ips_netdrv_open(struct rtw_adapter *padapter)
 	padapter->bCardDisableWOHSM = false;
 
 	status = rtl8723au_hal_init(padapter);
-	if (status == _FAIL) {
+	if (status < 0) {
 		RT_TRACE(_module_os_intfs_c_, _drv_err_,
 			 ("ips_netdrv_open(): Can't init h/w!\n"));
 		goto netdev_open23a_error;
@@ -744,14 +744,14 @@  static int ips_netdrv_open(struct rtw_adapter *padapter)
 	mod_timer(&padapter->mlmepriv.dynamic_chk_timer,
 		  jiffies + msecs_to_jiffies(5000));
 
-	return _SUCCESS;
+	return 0;
 
 netdev_open23a_error:
 	/* padapter->bup = false; */
 	DBG_8723A("-ips_netdrv_open - drv_open failure, bup =%d\n",
 		  padapter->bup);
 
-	return _FAIL;
+	return -EINVAL;
 }
 
 int rtw_ips_pwr_up23a(struct rtw_adapter *padapter)
@@ -806,7 +806,7 @@  int pm_netdev_open23a(struct net_device *pnetdev, u8 bnormal)
 	if (bnormal)
 		status = netdev_open23a(pnetdev);
 	else
-		status = (_SUCCESS == ips_netdrv_open(netdev_priv(pnetdev))) ?
+		status = (0 == ips_netdrv_open(netdev_priv(pnetdev))) ?
 			 (0) : (-1);
 
 	return status;