staging: rtl8712: r8712_set_802_11_add_wep(): Change return values
Change call sites of r8712_set_802_11_add_wep to check for 0 and non-zero values (e.g -EINVAL, -ENOMEM) instead of for _SUCCESS and _FAIL. Change return values of r8712_set_802_11_add_wep from true and false and _SUCCESS to -EINVAL and the return value of r8712_set_key. Change return type from u8 to int to accommodate these new return values. Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com> Link: https://lore.kernel.org/r/20190722092341.21030-6-nishkadg.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
42ceb6731d
commit
34ef8dbe02
@ -419,8 +419,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param,
|
|||||||
pwep->KeyIndex |= 0x80000000;
|
pwep->KeyIndex |= 0x80000000;
|
||||||
memcpy(pwep->KeyMaterial, param->u.crypt.key, pwep->KeyLength);
|
memcpy(pwep->KeyMaterial, param->u.crypt.key, pwep->KeyLength);
|
||||||
if (param->u.crypt.set_tx) {
|
if (param->u.crypt.set_tx) {
|
||||||
if (r8712_set_802_11_add_wep(padapter, pwep) ==
|
if (r8712_set_802_11_add_wep(padapter, pwep))
|
||||||
(u8)_FAIL)
|
|
||||||
ret = -EOPNOTSUPP;
|
ret = -EOPNOTSUPP;
|
||||||
} else {
|
} else {
|
||||||
/* don't update "psecuritypriv->PrivacyAlgrthm" and
|
/* don't update "psecuritypriv->PrivacyAlgrthm" and
|
||||||
@ -1585,7 +1584,7 @@ static int r8711_wx_set_enc(struct net_device *dev,
|
|||||||
}
|
}
|
||||||
wep.KeyIndex |= 0x80000000; /* transmit key */
|
wep.KeyIndex |= 0x80000000; /* transmit key */
|
||||||
memcpy(wep.KeyMaterial, keybuf, wep.KeyLength);
|
memcpy(wep.KeyMaterial, keybuf, wep.KeyLength);
|
||||||
if (r8712_set_802_11_add_wep(padapter, &wep) == _FAIL)
|
if (r8712_set_802_11_add_wep(padapter, &wep))
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -327,7 +327,7 @@ u8 r8712_set_802_11_authentication_mode(struct _adapter *padapter,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 r8712_set_802_11_add_wep(struct _adapter *padapter,
|
int r8712_set_802_11_add_wep(struct _adapter *padapter,
|
||||||
struct NDIS_802_11_WEP *wep)
|
struct NDIS_802_11_WEP *wep)
|
||||||
{
|
{
|
||||||
sint keyid;
|
sint keyid;
|
||||||
@ -335,7 +335,7 @@ u8 r8712_set_802_11_add_wep(struct _adapter *padapter,
|
|||||||
|
|
||||||
keyid = wep->KeyIndex & 0x3fffffff;
|
keyid = wep->KeyIndex & 0x3fffffff;
|
||||||
if (keyid >= WEP_KEYS)
|
if (keyid >= WEP_KEYS)
|
||||||
return false;
|
return -EINVAL;
|
||||||
switch (wep->KeyLength) {
|
switch (wep->KeyLength) {
|
||||||
case 5:
|
case 5:
|
||||||
psecuritypriv->PrivacyAlgrthm = _WEP40_;
|
psecuritypriv->PrivacyAlgrthm = _WEP40_;
|
||||||
@ -351,7 +351,5 @@ u8 r8712_set_802_11_add_wep(struct _adapter *padapter,
|
|||||||
wep->KeyLength);
|
wep->KeyLength);
|
||||||
psecuritypriv->DefKeylen[keyid] = wep->KeyLength;
|
psecuritypriv->DefKeylen[keyid] = wep->KeyLength;
|
||||||
psecuritypriv->PrivacyKeyIndex = keyid;
|
psecuritypriv->PrivacyKeyIndex = keyid;
|
||||||
if (r8712_set_key(padapter, psecuritypriv, keyid))
|
return r8712_set_key(padapter, psecuritypriv, keyid);
|
||||||
return false;
|
|
||||||
return _SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ u8 r8712_set_802_11_authentication_mode(struct _adapter *pdapter,
|
|||||||
|
|
||||||
u8 r8712_set_802_11_bssid(struct _adapter *padapter, u8 *bssid);
|
u8 r8712_set_802_11_bssid(struct _adapter *padapter, u8 *bssid);
|
||||||
|
|
||||||
u8 r8712_set_802_11_add_wep(struct _adapter *padapter,
|
int r8712_set_802_11_add_wep(struct _adapter *padapter,
|
||||||
struct NDIS_802_11_WEP *wep);
|
struct NDIS_802_11_WEP *wep);
|
||||||
|
|
||||||
u8 r8712_set_802_11_disassociate(struct _adapter *padapter);
|
u8 r8712_set_802_11_disassociate(struct _adapter *padapter);
|
||||||
|
Loading…
Reference in New Issue
Block a user