staging: rtl8712: r8712_set_key(): Change return values
authorNishka Dasgupta <nishkadg.linux@gmail.com>
Mon, 22 Jul 2019 09:23:36 +0000 (14:53 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Jul 2019 07:52:00 +0000 (09:52 +0200)
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>
drivers/staging/rtl8712/rtl871x_ioctl_set.c
drivers/staging/rtl8712/rtl871x_mlme.c
drivers/staging/rtl8712/rtl871x_mlme.h

index c12adb9a6c37d8ca964154c2543b8a9c0424c009..54b16bc4146597e2d833e251da3b4caeac90e802 100644 (file)
@@ -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;
 }
index 9c373a84ca0de95291947a5c87b82dc07a978a9a..cabdb3549a5a0ff45a2d626094ed400e785fd447 100644 (file)
@@ -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);
index 47499e879688c014157cf173719fb4fcde5710fc..46effb469fd4424fe000c6e2968fbf5cb719d16f 100644 (file)
@@ -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);