Commit e1b5fe74 authored by Nishka Dasgupta's avatar Nishka Dasgupta Committed by Greg Kroah-Hartman
Browse files

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: default avatarNishka Dasgupta <nishkadg.linux@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a024c9df
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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);
+3 −3
Original line number Diff line number Diff line
@@ -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 */
+1 −1
Original line number Diff line number Diff line
@@ -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);