staging: rtl8712: r8712_set_key(): Change return values

Change return values of r8712_set_key from _SUCCESS and _FAIL to 0 and
-ENOMEM or -EINVAL, as the case may require.
Modify return statements and return variable accordingly.
Change return type from sint to int.
As there is only one site where the return value is used, update that
call site according to the change in the return values.

Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
Link: https://lore.kernel.org/r/20190722092341.21030-3-nishkadg.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Nishka Dasgupta 2019-07-22 14:53:36 +05:30 committed by Greg Kroah-Hartman
parent 33972d48c2
commit 8a73a8c465
3 changed files with 13 additions and 13 deletions

View File

@ -351,7 +351,7 @@ u8 r8712_set_802_11_add_wep(struct _adapter *padapter,
wep->KeyLength);
psecuritypriv->DefKeylen[keyid] = wep->KeyLength;
psecuritypriv->PrivacyKeyIndex = keyid;
if (r8712_set_key(padapter, psecuritypriv, keyid) == _FAIL)
if (r8712_set_key(padapter, psecuritypriv, keyid))
return false;
return _SUCCESS;
}

View File

@ -1171,22 +1171,22 @@ int r8712_set_auth(struct _adapter *adapter,
return 0;
}
sint r8712_set_key(struct _adapter *adapter,
struct security_priv *psecuritypriv,
sint keyid)
int r8712_set_key(struct _adapter *adapter,
struct security_priv *psecuritypriv,
sint keyid)
{
struct cmd_priv *pcmdpriv = &adapter->cmdpriv;
struct cmd_obj *pcmd;
struct setkey_parm *psetkeyparm;
u8 keylen;
sint ret = _SUCCESS;
int ret;
pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC);
if (!pcmd)
return _FAIL;
return -ENOMEM;
psetkeyparm = kzalloc(sizeof(*psetkeyparm), GFP_ATOMIC);
if (!psetkeyparm) {
ret = _FAIL;
ret = -ENOMEM;
goto err_free_cmd;
}
if (psecuritypriv->AuthAlgrthm == 2) { /* 802.1X */
@ -1211,7 +1211,7 @@ sint r8712_set_key(struct _adapter *adapter,
break;
case _TKIP_:
if (keyid < 1 || keyid > 2) {
ret = _FAIL;
ret = -EINVAL;
goto err_free_parm;
}
keylen = 16;
@ -1221,7 +1221,7 @@ sint r8712_set_key(struct _adapter *adapter,
break;
case _AES_:
if (keyid < 1 || keyid > 2) {
ret = _FAIL;
ret = -EINVAL;
goto err_free_parm;
}
keylen = 16;
@ -1230,7 +1230,7 @@ sint r8712_set_key(struct _adapter *adapter,
psetkeyparm->grpkey = 1;
break;
default:
ret = _FAIL;
ret = -EINVAL;
goto err_free_parm;
}
pcmd->cmdcode = _SetKey_CMD_;
@ -1240,7 +1240,7 @@ sint r8712_set_key(struct _adapter *adapter,
pcmd->rspsz = 0;
INIT_LIST_HEAD(&pcmd->list);
r8712_enqueue_cmd(pcmdpriv, pcmd);
return ret;
return 0;
err_free_parm:
kfree(psetkeyparm);

View File

@ -173,8 +173,8 @@ void r8712_free_network_queue(struct _adapter *adapter);
int r8712_init_mlme_priv(struct _adapter *adapter);
void r8712_free_mlme_priv(struct mlme_priv *pmlmepriv);
int r8712_select_and_join_from_scan(struct mlme_priv *pmlmepriv);
sint r8712_set_key(struct _adapter *adapter,
struct security_priv *psecuritypriv, sint keyid);
int r8712_set_key(struct _adapter *adapter,
struct security_priv *psecuritypriv, sint keyid);
int r8712_set_auth(struct _adapter *adapter,
struct security_priv *psecuritypriv);
uint r8712_get_wlan_bssid_ex_sz(struct wlan_bssid_ex *bss);