staging: rtl8712: init_drv_sw(): Change return values

Change return values of init_drv_sw from _SUCCESS and _FAIL to 0 and
-ENOMEM. Change return type from u8 to int to allow this.
Add a return variable to streamline return of error codes of called
functions.
Modify call site to check for non-zero return value instead of _FAIL.

Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
Link: https://lore.kernel.org/r/20190808064012.12661-7-nishkadg.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Nishka Dasgupta 2019-08-08 12:10:09 +05:30 committed by Greg Kroah-Hartman
parent 30d83c801d
commit 690407fdc9
3 changed files with 18 additions and 12 deletions

View File

@ -294,30 +294,36 @@ static void init_default_value(struct _adapter *padapter)
/*misc.*/
}
u8 r8712_init_drv_sw(struct _adapter *padapter)
int r8712_init_drv_sw(struct _adapter *padapter)
{
if (r8712_init_cmd_priv(&padapter->cmdpriv))
return _FAIL;
int ret;
ret = r8712_init_cmd_priv(&padapter->cmdpriv);
if (ret)
return ret;
padapter->cmdpriv.padapter = padapter;
if (r8712_init_evt_priv(&padapter->evtpriv))
return _FAIL;
if (r8712_init_mlme_priv(padapter))
return _FAIL;
ret = r8712_init_evt_priv(&padapter->evtpriv);
if (ret)
return ret;
ret = r8712_init_mlme_priv(padapter);
if (ret)
return ret;
_r8712_init_xmit_priv(&padapter->xmitpriv, padapter);
_r8712_init_recv_priv(&padapter->recvpriv, padapter);
memset((unsigned char *)&padapter->securitypriv, 0,
sizeof(struct security_priv));
timer_setup(&padapter->securitypriv.tkip_timer,
r8712_use_tkipkey_handler, 0);
if (_r8712_init_sta_priv(&padapter->stapriv))
return _FAIL;
ret = _r8712_init_sta_priv(&padapter->stapriv);
if (ret)
return ret;
padapter->stapriv.padapter = padapter;
r8712_init_bcmc_stainfo(padapter);
r8712_init_pwrctrl_priv(padapter);
mp871xinit(padapter);
init_default_value(padapter);
r8712_InitSwLeds(padapter);
return _SUCCESS;
return ret;
}
u8 r8712_free_drv_sw(struct _adapter *padapter)

View File

@ -389,7 +389,7 @@ static int r871xu_drv_init(struct usb_interface *pusb_intf,
}
/* step 4. */
status = r8712_init_drv_sw(padapter);
if (status == _FAIL)
if (status)
goto error;
/* step 5. read efuse/eeprom data and get mac_addr */
{

View File

@ -28,7 +28,7 @@ void rtl871x_intf_stop(struct _adapter *padapter);
void r871x_dev_unload(struct _adapter *padapter);
void r8712_stop_drv_threads(struct _adapter *padapter);
void r8712_stop_drv_timers(struct _adapter *padapter);
u8 r8712_init_drv_sw(struct _adapter *padapter);
int r8712_init_drv_sw(struct _adapter *padapter);
u8 r8712_free_drv_sw(struct _adapter *padapter);
struct net_device *r8712_init_netdev(void);