mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-10 06:49:29 -04:00
staging: r8188eu: handle rtw_init_netdev_name() failure appropriately
rtw_init_netdev_name() calls dev_alloc_name() which allocates the name for the device as per the given name format. The name format is specified by the module parameter "ifname". It returns a negative err code if the format is invalid. Handle this error appropriately. Cancel the timers ininitliazed by rtw_init_drv_sw() before calling rtw_free_drv_sw() and then proceed to free the adapter. Also, if register_netdev() fails then goto free_drv_sw instead of goto handle_dualmac. Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Vihas Mak <makvihas@gmail.com> Link: https://lore.kernel.org/r/20220123181734.10402-1-makvihas@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
6cc2d1a653
commit
055a2e2ca6
@@ -399,7 +399,11 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj,
|
||||
DBG_88E("can't get autopm:\n");
|
||||
|
||||
/* alloc dev name after read efuse. */
|
||||
rtw_init_netdev_name(pnetdev, padapter->registrypriv.ifname);
|
||||
if (rtw_init_netdev_name(pnetdev, padapter->registrypriv.ifname) < 0) {
|
||||
DBG_88E("rtw_init_netdev_name failed, ifname:%s\n",
|
||||
padapter->registrypriv.ifname);
|
||||
goto free_drv_sw;
|
||||
}
|
||||
rtw_macaddr_cfg(padapter->eeprompriv.mac_addr);
|
||||
rtw_init_wifidirect_addrs(padapter, padapter->eeprompriv.mac_addr,
|
||||
padapter->eeprompriv.mac_addr);
|
||||
@@ -409,7 +413,7 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj,
|
||||
|
||||
/* step 6. Tell the network stack we exist */
|
||||
if (register_netdev(pnetdev) != 0)
|
||||
goto handle_dualmac;
|
||||
goto free_drv_sw;
|
||||
|
||||
DBG_88E("bDriverStopped:%d, bSurpriseRemoved:%d, bup:%d, hw_init_completed:%d\n"
|
||||
, padapter->bDriverStopped
|
||||
@@ -420,6 +424,11 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj,
|
||||
|
||||
status = _SUCCESS;
|
||||
|
||||
free_drv_sw:
|
||||
if (status != _SUCCESS) {
|
||||
rtw_cancel_all_timer(padapter);
|
||||
rtw_free_drv_sw(padapter);
|
||||
}
|
||||
handle_dualmac:
|
||||
if (status != _SUCCESS)
|
||||
rtw_handle_dualmac(padapter, 0);
|
||||
|
||||
Reference in New Issue
Block a user