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

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>

authored by

Nishka Dasgupta and committed by
Greg Kroah-Hartman
8a73a8c4 33972d48

+13 -13
+1 -1
drivers/staging/rtl8712/rtl871x_ioctl_set.c
··· 351 351 wep->KeyLength); 352 352 psecuritypriv->DefKeylen[keyid] = wep->KeyLength; 353 353 psecuritypriv->PrivacyKeyIndex = keyid; 354 - if (r8712_set_key(padapter, psecuritypriv, keyid) == _FAIL) 354 + if (r8712_set_key(padapter, psecuritypriv, keyid)) 355 355 return false; 356 356 return _SUCCESS; 357 357 }
+10 -10
drivers/staging/rtl8712/rtl871x_mlme.c
··· 1171 1171 return 0; 1172 1172 } 1173 1173 1174 - sint r8712_set_key(struct _adapter *adapter, 1175 - struct security_priv *psecuritypriv, 1176 - sint keyid) 1174 + int r8712_set_key(struct _adapter *adapter, 1175 + struct security_priv *psecuritypriv, 1176 + sint keyid) 1177 1177 { 1178 1178 struct cmd_priv *pcmdpriv = &adapter->cmdpriv; 1179 1179 struct cmd_obj *pcmd; 1180 1180 struct setkey_parm *psetkeyparm; 1181 1181 u8 keylen; 1182 - sint ret = _SUCCESS; 1182 + int ret; 1183 1183 1184 1184 pcmd = kmalloc(sizeof(*pcmd), GFP_ATOMIC); 1185 1185 if (!pcmd) 1186 - return _FAIL; 1186 + return -ENOMEM; 1187 1187 psetkeyparm = kzalloc(sizeof(*psetkeyparm), GFP_ATOMIC); 1188 1188 if (!psetkeyparm) { 1189 - ret = _FAIL; 1189 + ret = -ENOMEM; 1190 1190 goto err_free_cmd; 1191 1191 } 1192 1192 if (psecuritypriv->AuthAlgrthm == 2) { /* 802.1X */ ··· 1211 1211 break; 1212 1212 case _TKIP_: 1213 1213 if (keyid < 1 || keyid > 2) { 1214 - ret = _FAIL; 1214 + ret = -EINVAL; 1215 1215 goto err_free_parm; 1216 1216 } 1217 1217 keylen = 16; ··· 1221 1221 break; 1222 1222 case _AES_: 1223 1223 if (keyid < 1 || keyid > 2) { 1224 - ret = _FAIL; 1224 + ret = -EINVAL; 1225 1225 goto err_free_parm; 1226 1226 } 1227 1227 keylen = 16; ··· 1230 1230 psetkeyparm->grpkey = 1; 1231 1231 break; 1232 1232 default: 1233 - ret = _FAIL; 1233 + ret = -EINVAL; 1234 1234 goto err_free_parm; 1235 1235 } 1236 1236 pcmd->cmdcode = _SetKey_CMD_; ··· 1240 1240 pcmd->rspsz = 0; 1241 1241 INIT_LIST_HEAD(&pcmd->list); 1242 1242 r8712_enqueue_cmd(pcmdpriv, pcmd); 1243 - return ret; 1243 + return 0; 1244 1244 1245 1245 err_free_parm: 1246 1246 kfree(psetkeyparm);
+2 -2
drivers/staging/rtl8712/rtl871x_mlme.h
··· 173 173 int r8712_init_mlme_priv(struct _adapter *adapter); 174 174 void r8712_free_mlme_priv(struct mlme_priv *pmlmepriv); 175 175 int r8712_select_and_join_from_scan(struct mlme_priv *pmlmepriv); 176 - sint r8712_set_key(struct _adapter *adapter, 177 - struct security_priv *psecuritypriv, sint keyid); 176 + int r8712_set_key(struct _adapter *adapter, 177 + struct security_priv *psecuritypriv, sint keyid); 178 178 int r8712_set_auth(struct _adapter *adapter, 179 179 struct security_priv *psecuritypriv); 180 180 uint r8712_get_wlan_bssid_ex_sz(struct wlan_bssid_ex *bss);