staging: rtl8712: _r8712_init_sta_priv(): Change return values
authorNishka Dasgupta <nishkadg.linux@gmail.com>
Wed, 26 Jun 2019 06:09:38 +0000 (11:39 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 1 Jul 2019 08:44:06 +0000 (10:44 +0200)
Add check for the return value of function _r8712_init_sta_priv at call
site.
Change return values of the function from _SUCCESS/_FAIL to 0/-ENOMEM
respectively.
Change return type of the function from u32 to int to enable return of
-ENOMEM.

Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8712/os_intfs.c
drivers/staging/rtl8712/rtl871x_sta_mgt.c
drivers/staging/rtl8712/sta_info.h

index 85a43fd67ca5d80b3756a1d77623d31f9dfc9100..b554cf8bd679a430ba1932751a8e95a3b76b8a26 100644 (file)
@@ -310,7 +310,8 @@ u8 r8712_init_drv_sw(struct _adapter *padapter)
               sizeof(struct security_priv));
        timer_setup(&padapter->securitypriv.tkip_timer,
                    r8712_use_tkipkey_handler, 0);
-       _r8712_init_sta_priv(&padapter->stapriv);
+       if (_r8712_init_sta_priv(&padapter->stapriv))
+               return _FAIL;
        padapter->stapriv.padapter = padapter;
        r8712_init_bcmc_stainfo(padapter);
        r8712_init_pwrctrl_priv(padapter);
index b549ab37f2dc6a56a53d71fbadb04285db88ce48..653812c5d5a83b300870c411f08c401ae6f59684 100644 (file)
@@ -34,7 +34,7 @@ static void _init_stainfo(struct sta_info *psta)
        INIT_LIST_HEAD(&psta->auth_list);
 }
 
-u32 _r8712_init_sta_priv(struct        sta_priv *pstapriv)
+int _r8712_init_sta_priv(struct        sta_priv *pstapriv)
 {
        struct sta_info *psta;
        s32 i;
@@ -42,7 +42,7 @@ u32 _r8712_init_sta_priv(struct       sta_priv *pstapriv)
        pstapriv->pallocated_stainfo_buf = kmalloc(sizeof(struct sta_info) *
                                                   NUM_STA + 4, GFP_ATOMIC);
        if (!pstapriv->pallocated_stainfo_buf)
-               return _FAIL;
+               return -ENOMEM;
        pstapriv->pstainfo_buf = pstapriv->pallocated_stainfo_buf + 4 -
                ((addr_t)(pstapriv->pallocated_stainfo_buf) & 3);
        _init_queue(&pstapriv->free_sta_queue);
@@ -59,7 +59,7 @@ u32 _r8712_init_sta_priv(struct       sta_priv *pstapriv)
        }
        INIT_LIST_HEAD(&pstapriv->asoc_list);
        INIT_LIST_HEAD(&pstapriv->auth_list);
-       return _SUCCESS;
+       return 0;
 }
 
 /* this function is used to free the memory of lock || sema for all stainfos */
index fc32dc0bed001fae2828b3e96969f6200c8c02c2..d042d900f30c46c8ab62af06db8d9d12660754ad 100644 (file)
@@ -119,7 +119,7 @@ static inline u32 wifi_mac_hash(u8 *mac)
        return x;
 }
 
-u32 _r8712_init_sta_priv(struct sta_priv *pstapriv);
+int _r8712_init_sta_priv(struct sta_priv *pstapriv);
 void _r8712_free_sta_priv(struct sta_priv *pstapriv);
 struct sta_info *r8712_alloc_stainfo(struct sta_priv *pstapriv,
                                     u8 *hwaddr);