Commit 34ef8dbe authored by Nishka Dasgupta's avatar Nishka Dasgupta Committed by Greg Kroah-Hartman

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: default avatarNishka Dasgupta <nishkadg.linux@gmail.com>
Link: https://lore.kernel.org/r/20190722092341.21030-6-nishkadg.linux@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 42ceb673
...@@ -419,8 +419,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, ...@@ -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, ...@@ -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,15 +327,15 @@ u8 r8712_set_802_11_authentication_mode(struct _adapter *padapter, ...@@ -327,15 +327,15 @@ 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;
struct security_priv *psecuritypriv = &padapter->securitypriv; struct security_priv *psecuritypriv = &padapter->securitypriv;
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, ...@@ -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,8 +28,8 @@ u8 r8712_set_802_11_authentication_mode(struct _adapter *pdapter, ...@@ -28,8 +28,8 @@ 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);
......
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