iavf: use unregister_netdev

Use unregister_netdev, which takes rtnl_lock for us. We don't have to
check the reg_state under rtnl_lock. There's nothing to race with. We
have just cancelled the finish_config work.

Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://lore.kernel.org/r/20231027175941.1340255-7-jacob.e.keller@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Michal Schmidt 2023-10-27 10:59:39 -07:00 committed by Jakub Kicinski
parent 34ad34bf06
commit 5c4e1d1874

View File

@ -5167,10 +5167,8 @@ static void iavf_remove(struct pci_dev *pdev)
cancel_delayed_work_sync(&adapter->watchdog_task);
cancel_work_sync(&adapter->finish_config);
rtnl_lock();
if (netdev->reg_state == NETREG_REGISTERED)
unregister_netdevice(netdev);
rtnl_unlock();
unregister_netdev(netdev);
if (CLIENT_ALLOWED(adapter)) {
err = iavf_lan_del_device(adapter);