Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Nishka Dasgupta and committed by
Greg Kroah-Hartman
e1b5fe74 a024c9df

+6 -5
+2 -1
drivers/staging/rtl8712/os_intfs.c
··· 310 310 sizeof(struct security_priv)); 311 311 timer_setup(&padapter->securitypriv.tkip_timer, 312 312 r8712_use_tkipkey_handler, 0); 313 - _r8712_init_sta_priv(&padapter->stapriv); 313 + if (_r8712_init_sta_priv(&padapter->stapriv)) 314 + return _FAIL; 314 315 padapter->stapriv.padapter = padapter; 315 316 r8712_init_bcmc_stainfo(padapter); 316 317 r8712_init_pwrctrl_priv(padapter);
+3 -3
drivers/staging/rtl8712/rtl871x_sta_mgt.c
··· 34 34 INIT_LIST_HEAD(&psta->auth_list); 35 35 } 36 36 37 - u32 _r8712_init_sta_priv(struct sta_priv *pstapriv) 37 + int _r8712_init_sta_priv(struct sta_priv *pstapriv) 38 38 { 39 39 struct sta_info *psta; 40 40 s32 i; ··· 42 42 pstapriv->pallocated_stainfo_buf = kmalloc(sizeof(struct sta_info) * 43 43 NUM_STA + 4, GFP_ATOMIC); 44 44 if (!pstapriv->pallocated_stainfo_buf) 45 - return _FAIL; 45 + return -ENOMEM; 46 46 pstapriv->pstainfo_buf = pstapriv->pallocated_stainfo_buf + 4 - 47 47 ((addr_t)(pstapriv->pallocated_stainfo_buf) & 3); 48 48 _init_queue(&pstapriv->free_sta_queue); ··· 59 59 } 60 60 INIT_LIST_HEAD(&pstapriv->asoc_list); 61 61 INIT_LIST_HEAD(&pstapriv->auth_list); 62 - return _SUCCESS; 62 + return 0; 63 63 } 64 64 65 65 /* this function is used to free the memory of lock || sema for all stainfos */
+1 -1
drivers/staging/rtl8712/sta_info.h
··· 119 119 return x; 120 120 } 121 121 122 - u32 _r8712_init_sta_priv(struct sta_priv *pstapriv); 122 + int _r8712_init_sta_priv(struct sta_priv *pstapriv); 123 123 void _r8712_free_sta_priv(struct sta_priv *pstapriv); 124 124 struct sta_info *r8712_alloc_stainfo(struct sta_priv *pstapriv, 125 125 u8 *hwaddr);