diff --git a/os_dep/linux/os_intfs.c b/os_dep/linux/os_intfs.c index b3c82c8..3e182a5 100644 --- a/os_dep/linux/os_intfs.c +++ b/os_dep/linux/os_intfs.c @@ -1650,19 +1650,21 @@ void rtw_os_ndev_unregister(_adapter *adapter) netdev = adapter->pnetdev; - if ((adapter->DriverState != DRIVER_DISAPPEAR) && netdev) { - struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); - u8 rtnl_lock_needed = rtw_rtnl_lock_needed(dvobj); - - if (rtnl_lock_needed) - unregister_netdev(netdev); - else - unregister_netdevice(netdev); - } #if defined(CONFIG_IOCTL_CFG80211) rtw_cfg80211_ndev_res_unregister(adapter); #endif + if ((adapter->DriverState != DRIVER_DISAPPEAR) && netdev) { + struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); + u8 rtnl_lock_needed = rtw_rtnl_lock_needed(dvobj); + + if (rtnl_lock_needed) + unregister_netdev(netdev); + else + unregister_netdevice(netdev); + } + + #if defined(CONFIG_IOCTL_CFG80211) && !defined(RTW_SINGLE_WIPHY) #ifdef CONFIG_RFKILL_POLL rtw_cfg80211_deinit_rfkill(adapter_to_wiphy(adapter));