Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Nishka Dasgupta and committed by
Greg Kroah-Hartman
34ef8dbe 42ceb673

+8 -11
+2 -3
drivers/staging/rtl8712/rtl871x_ioctl_linux.c
··· 419 419 pwep->KeyIndex |= 0x80000000; 420 420 memcpy(pwep->KeyMaterial, param->u.crypt.key, pwep->KeyLength); 421 421 if (param->u.crypt.set_tx) { 422 - if (r8712_set_802_11_add_wep(padapter, pwep) == 423 - (u8)_FAIL) 422 + if (r8712_set_802_11_add_wep(padapter, pwep)) 424 423 ret = -EOPNOTSUPP; 425 424 } else { 426 425 /* don't update "psecuritypriv->PrivacyAlgrthm" and ··· 1584 1585 } 1585 1586 wep.KeyIndex |= 0x80000000; /* transmit key */ 1586 1587 memcpy(wep.KeyMaterial, keybuf, wep.KeyLength); 1587 - if (r8712_set_802_11_add_wep(padapter, &wep) == _FAIL) 1588 + if (r8712_set_802_11_add_wep(padapter, &wep)) 1588 1589 return -EOPNOTSUPP; 1589 1590 return 0; 1590 1591 }
+4 -6
drivers/staging/rtl8712/rtl871x_ioctl_set.c
··· 327 327 return ret; 328 328 } 329 329 330 - u8 r8712_set_802_11_add_wep(struct _adapter *padapter, 331 - struct NDIS_802_11_WEP *wep) 330 + int r8712_set_802_11_add_wep(struct _adapter *padapter, 331 + struct NDIS_802_11_WEP *wep) 332 332 { 333 333 sint keyid; 334 334 struct security_priv *psecuritypriv = &padapter->securitypriv; 335 335 336 336 keyid = wep->KeyIndex & 0x3fffffff; 337 337 if (keyid >= WEP_KEYS) 338 - return false; 338 + return -EINVAL; 339 339 switch (wep->KeyLength) { 340 340 case 5: 341 341 psecuritypriv->PrivacyAlgrthm = _WEP40_; ··· 351 351 wep->KeyLength); 352 352 psecuritypriv->DefKeylen[keyid] = wep->KeyLength; 353 353 psecuritypriv->PrivacyKeyIndex = keyid; 354 - if (r8712_set_key(padapter, psecuritypriv, keyid)) 355 - return false; 356 - return _SUCCESS; 354 + return r8712_set_key(padapter, psecuritypriv, keyid); 357 355 }
+2 -2
drivers/staging/rtl8712/rtl871x_ioctl_set.h
··· 28 28 29 29 u8 r8712_set_802_11_bssid(struct _adapter *padapter, u8 *bssid); 30 30 31 - u8 r8712_set_802_11_add_wep(struct _adapter *padapter, 32 - struct NDIS_802_11_WEP *wep); 31 + int r8712_set_802_11_add_wep(struct _adapter *padapter, 32 + struct NDIS_802_11_WEP *wep); 33 33 34 34 u8 r8712_set_802_11_disassociate(struct _adapter *padapter); 35 35