staging: rtl8712: _r8712_init_sta_priv(): Change return values
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>
This commit is contained in:
parent
a024c9dfef
commit
e1b5fe7412
drivers/staging/rtl8712
|
@ -310,7 +310,8 @@ u8 r8712_init_drv_sw(struct _adapter *padapter)
|
||||||
sizeof(struct security_priv));
|
sizeof(struct security_priv));
|
||||||
timer_setup(&padapter->securitypriv.tkip_timer,
|
timer_setup(&padapter->securitypriv.tkip_timer,
|
||||||
r8712_use_tkipkey_handler, 0);
|
r8712_use_tkipkey_handler, 0);
|
||||||
_r8712_init_sta_priv(&padapter->stapriv);
|
if (_r8712_init_sta_priv(&padapter->stapriv))
|
||||||
|
return _FAIL;
|
||||||
padapter->stapriv.padapter = padapter;
|
padapter->stapriv.padapter = padapter;
|
||||||
r8712_init_bcmc_stainfo(padapter);
|
r8712_init_bcmc_stainfo(padapter);
|
||||||
r8712_init_pwrctrl_priv(padapter);
|
r8712_init_pwrctrl_priv(padapter);
|
||||||
|
|
|
@ -34,7 +34,7 @@ static void _init_stainfo(struct sta_info *psta)
|
||||||
INIT_LIST_HEAD(&psta->auth_list);
|
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;
|
struct sta_info *psta;
|
||||||
s32 i;
|
s32 i;
|
||||||
|
@ -42,7 +42,7 @@ u32 _r8712_init_sta_priv(struct sta_priv *pstapriv)
|
||||||
pstapriv->pallocated_stainfo_buf = kmalloc(sizeof(struct sta_info) *
|
pstapriv->pallocated_stainfo_buf = kmalloc(sizeof(struct sta_info) *
|
||||||
NUM_STA + 4, GFP_ATOMIC);
|
NUM_STA + 4, GFP_ATOMIC);
|
||||||
if (!pstapriv->pallocated_stainfo_buf)
|
if (!pstapriv->pallocated_stainfo_buf)
|
||||||
return _FAIL;
|
return -ENOMEM;
|
||||||
pstapriv->pstainfo_buf = pstapriv->pallocated_stainfo_buf + 4 -
|
pstapriv->pstainfo_buf = pstapriv->pallocated_stainfo_buf + 4 -
|
||||||
((addr_t)(pstapriv->pallocated_stainfo_buf) & 3);
|
((addr_t)(pstapriv->pallocated_stainfo_buf) & 3);
|
||||||
_init_queue(&pstapriv->free_sta_queue);
|
_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->asoc_list);
|
||||||
INIT_LIST_HEAD(&pstapriv->auth_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 */
|
/* this function is used to free the memory of lock || sema for all stainfos */
|
||||||
|
|
|
@ -119,7 +119,7 @@ static inline u32 wifi_mac_hash(u8 *mac)
|
||||||
return x;
|
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);
|
void _r8712_free_sta_priv(struct sta_priv *pstapriv);
|
||||||
struct sta_info *r8712_alloc_stainfo(struct sta_priv *pstapriv,
|
struct sta_info *r8712_alloc_stainfo(struct sta_priv *pstapriv,
|
||||||
u8 *hwaddr);
|
u8 *hwaddr);
|
||||||
|
|
Loading…
Reference in New Issue