virtio-net: fix module unloading
authorAndrew Jones <drjones@redhat.com>
Mon, 24 Jul 2017 13:38:32 +0000 (15:38 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 25 Jul 2017 13:37:36 +0000 (16:37 +0300)
Unregister the driver before removing multi-instance hotplug
callbacks. This order avoids the warning issued from
__cpuhp_remove_state_cpuslocked when the number of remaining
instances isn't yet zero.

Fixes: 8017c279196a ("net/virtio-net: Convert to hotplug state machine")
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/net/virtio_net.c

index 99a26a9efec1ab695bae833a1f9dca437e9dde5c..f41ab0ea942a6e75a66ded6f9dcab2a999f920bb 100644 (file)
@@ -2743,9 +2743,9 @@ module_init(virtio_net_driver_init);
 
 static __exit void virtio_net_driver_exit(void)
 {
+       unregister_virtio_driver(&virtio_net_driver);
        cpuhp_remove_multi_state(CPUHP_VIRT_NET_DEAD);
        cpuhp_remove_multi_state(virtionet_online);
-       unregister_virtio_driver(&virtio_net_driver);
 }
 module_exit(virtio_net_driver_exit);