Commit 7e761c5a authored by Jes Sorensen's avatar Jes Sorensen Committed by Greg Kroah-Hartman

staging: rtl8723au: rtw_ioctl_set.c: Fix up messy error code handling

Signed-off-by: default avatarJes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 43eeb8ee
......@@ -22,13 +22,13 @@
#include <usb_ops.h>
#include <linux/ieee80211.h>
u8 rtw_do_join23a(struct rtw_adapter *padapter)
int rtw_do_join23a(struct rtw_adapter *padapter)
{
struct list_head *plist, *phead;
u8* pibss = NULL;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct rtw_queue *queue = &pmlmepriv->scanned_queue;
u8 ret = _SUCCESS;
int ret = _SUCCESS;
spin_lock_bh(&pmlmepriv->scanned_queue.lock);
phead = get_list_head(queue);
......@@ -151,9 +151,10 @@ u8 rtw_do_join23a(struct rtw_adapter *padapter)
return ret;
}
u8 rtw_set_802_11_ssid23a(struct rtw_adapter* padapter, struct cfg80211_ssid *ssid)
int rtw_set_802_11_ssid23a(struct rtw_adapter* padapter,
struct cfg80211_ssid *ssid)
{
u8 status = _SUCCESS;
int status = _SUCCESS;
u32 cur_time = 0;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
......@@ -278,7 +279,7 @@ u8 rtw_set_802_11_ssid23a(struct rtw_adapter* padapter, struct cfg80211_ssid *ss
return status;
}
u8 rtw_set_802_11_infrastructure_mode23a(struct rtw_adapter* padapter,
int rtw_set_802_11_infrastructure_mode23a(struct rtw_adapter* padapter,
enum ndis_802_11_net_infra networktype)
{
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
......@@ -361,25 +362,26 @@ u8 rtw_set_802_11_infrastructure_mode23a(struct rtw_adapter* padapter,
spin_unlock_bh(&pmlmepriv->lock);
}
return true;
return _SUCCESS;
}
u8 rtw_set_802_11_bssid23a_list_scan(struct rtw_adapter *padapter,
struct cfg80211_ssid *pssid, int ssid_max_num)
int rtw_set_802_11_bssid23a_list_scan(struct rtw_adapter *padapter,
struct cfg80211_ssid *pssid,
int ssid_max_num)
{
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
u8 res = true;
int res = _SUCCESS;
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
("+rtw_set_802_11_bssid23a_list_scan(), fw_state =%x\n",
get_fwstate(pmlmepriv)));
if (!padapter) {
res = false;
res = _FAIL;
goto exit;
}
if (padapter->hw_init_completed == false) {
res = false;
res = _FAIL;
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
("\n === rtw_set_802_11_bssid23a_list_scan:"
"hw_init_completed == false ===\n"));
......@@ -392,7 +394,6 @@ u8 rtw_set_802_11_bssid23a_list_scan(struct rtw_adapter *padapter,
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
("rtw_set_802_11_bssid23a_list_scan fail since fw_state "
"= %x\n", get_fwstate(pmlmepriv)));
res = true;
if (check_fwstate(pmlmepriv,
(_FW_UNDER_SURVEY|_FW_UNDER_LINKING))) {
......@@ -421,12 +422,11 @@ u8 rtw_set_802_11_bssid23a_list_scan(struct rtw_adapter *padapter,
return res;
}
u8 rtw_set_802_11_authentication_mode23a(struct rtw_adapter* padapter,
enum ndis_802_11_auth_mode authmode)
int rtw_set_802_11_authentication_mode23a(struct rtw_adapter* padapter,
enum ndis_802_11_auth_mode authmode)
{
struct security_priv *psecuritypriv = &padapter->securitypriv;
int res;
u8 ret;
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
("set_802_11_auth.mode(): mode =%x\n", authmode));
......@@ -443,22 +443,16 @@ u8 rtw_set_802_11_authentication_mode23a(struct rtw_adapter* padapter,
res = rtw_set_auth23a(padapter, psecuritypriv);
if (res == _SUCCESS)
ret = true;
else
ret = false;
return ret;
return res;
}
u8 rtw_set_802_11_add_wep23a(struct rtw_adapter* padapter,
int rtw_set_802_11_add_wep23a(struct rtw_adapter* padapter,
struct ndis_802_11_wep *wep)
{
u8 bdefaultkey;
u8 btransmitkey;
int keyid, res;
struct security_priv *psecuritypriv = &padapter->securitypriv;
u8 ret = _SUCCESS;
bdefaultkey = (wep->KeyIndex & 0x40000000) > 0 ? false : true;
btransmitkey = (wep->KeyIndex & 0x80000000) > 0 ? true : false;
......@@ -467,7 +461,7 @@ u8 rtw_set_802_11_add_wep23a(struct rtw_adapter* padapter,
if (keyid >= 4) {
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
("MgntActrtw_set_802_11_add_wep23a:keyid>4 =>fail\n"));
ret = false;
res = _FAIL;
goto exit;
}
......@@ -522,11 +516,9 @@ u8 rtw_set_802_11_add_wep23a(struct rtw_adapter* padapter,
res = rtw_set_key23a(padapter, psecuritypriv, keyid, 1);
if (res == _FAIL)
ret = false;
exit:
return ret;
return res;
}
/*
......
......@@ -17,18 +17,20 @@
#include <drv_types.h>
u8 rtw_set_802_11_authentication_mode23a(struct rtw_adapter *pdapter,
enum ndis_802_11_auth_mode authmode);
u8 rtw_set_802_11_add_wep23a(struct rtw_adapter * padapter,
struct ndis_802_11_wep *wep);
u8 rtw_set_802_11_bssid23a_list_scan(struct rtw_adapter *padapter,
struct cfg80211_ssid *pssid, int ssid_max_num);
u8 rtw_set_802_11_infrastructure_mode23a(struct rtw_adapter *padapter,
enum ndis_802_11_net_infra networktype);
u8 rtw_set_802_11_ssid23a(struct rtw_adapter * padapter, struct cfg80211_ssid * ssid);
int rtw_set_802_11_authentication_mode23a(struct rtw_adapter *pdapter,
enum ndis_802_11_auth_mode authmode);
int rtw_set_802_11_add_wep23a(struct rtw_adapter * padapter,
struct ndis_802_11_wep *wep);
int rtw_set_802_11_bssid23a_list_scan(struct rtw_adapter *padapter,
struct cfg80211_ssid *pssid,
int ssid_max_num);
int rtw_set_802_11_infrastructure_mode23a(struct rtw_adapter *padapter,
enum ndis_802_11_net_infra networktype);
int rtw_set_802_11_ssid23a(struct rtw_adapter * padapter,
struct cfg80211_ssid * ssid);
u16 rtw_get_cur_max_rate23a(struct rtw_adapter *adapter);
s32 FillH2CCmd(struct rtw_adapter *padapter, u8 ElementID, u32 CmdLen, u8 *pCmdBuffer);
u8 rtw_do_join23a(struct rtw_adapter *padapter);
int rtw_do_join23a(struct rtw_adapter *padapter);
#endif
......@@ -1343,7 +1343,8 @@ static int cfg80211_rtw_change_iface(struct wiphy *wiphy,
rtw_wdev->iftype = type;
if (rtw_set_802_11_infrastructure_mode23a(padapter, networkType) == false) {
if (rtw_set_802_11_infrastructure_mode23a
(padapter, networkType) != _SUCCESS) {
rtw_wdev->iftype = old_type;
ret = -EPERM;
goto exit;
......@@ -1982,7 +1983,7 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev,
}
if (rtw_set_802_11_infrastructure_mode23a
(padapter, pnetwork->network.InfrastructureMode) == false) {
(padapter, pnetwork->network.InfrastructureMode) != _SUCCESS) {
ret = -EPERM;
goto exit;
}
......@@ -2069,9 +2070,8 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev,
memcpy(pwep->KeyMaterial, (void *)sme->key, pwep->KeyLength);
if (rtw_set_802_11_add_wep23a(padapter, pwep) == (u8) _FAIL) {
if (rtw_set_802_11_add_wep23a(padapter, pwep) != _SUCCESS)
ret = -EOPNOTSUPP;
}
kfree(pwep);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment