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@xxxxxxxxx> --- drivers/staging/rtl8712/rtl871x_ioctl_set.c | 2 +- drivers/staging/rtl8712/rtl871x_mlme.c | 20 ++++++++++---------- drivers/staging/rtl8712/rtl871x_mlme.h | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_set.c b/drivers/staging/rtl8712/rtl871x_ioctl_set.c index c12adb9a6c37..54b16bc41465 100644 --- a/drivers/staging/rtl8712/rtl871x_ioctl_set.c +++ b/drivers/staging/rtl8712/rtl871x_ioctl_set.c @@ -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; } diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c index 9c373a84ca0d..cabdb3549a5a 100644 --- a/drivers/staging/rtl8712/rtl871x_mlme.c +++ b/drivers/staging/rtl8712/rtl871x_mlme.c @@ -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); diff --git a/drivers/staging/rtl8712/rtl871x_mlme.h b/drivers/staging/rtl8712/rtl871x_mlme.h index 47499e879688..46effb469fd4 100644 --- a/drivers/staging/rtl8712/rtl871x_mlme.h +++ b/drivers/staging/rtl8712/rtl871x_mlme.h @@ -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); -- 2.19.1 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel