staging: r8188eu: handle rtw_init_netdev_name() failure appropriately
authorVihas Mak <makvihas@gmail.com>
Sun, 23 Jan 2022 18:17:35 +0000 (23:47 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 25 Jan 2022 15:29:24 +0000 (16:29 +0100)
commit055a2e2ca6d601a21dc95d435d9ea9bf9280921a
tree10a36229b38427c854cb368c66d9e9ac12a466cc
parent6cc2d1a6536788f6334217440a2956c7e73f87f6
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>
drivers/staging/r8188eu/os_dep/usb_intf.c