@@ -1734,30 +1734,30 @@ static int __init init_net_drop_monitor(void)
1734
1734
return - ENOSPC ;
1735
1735
}
1736
1736
1737
- rc = genl_register_family (& net_drop_monitor_family );
1738
- if (rc ) {
1739
- pr_err ("Could not create drop monitor netlink family\n" );
1740
- return rc ;
1737
+ for_each_possible_cpu (cpu ) {
1738
+ net_dm_cpu_data_init (cpu );
1739
+ net_dm_hw_cpu_data_init (cpu );
1741
1740
}
1742
- WARN_ON (net_drop_monitor_family .mcgrp_offset != NET_DM_GRP_ALERT );
1743
1741
1744
1742
rc = register_netdevice_notifier (& dropmon_net_notifier );
1745
1743
if (rc < 0 ) {
1746
1744
pr_crit ("Failed to register netdevice notifier\n" );
1745
+ return rc ;
1746
+ }
1747
+
1748
+ rc = genl_register_family (& net_drop_monitor_family );
1749
+ if (rc ) {
1750
+ pr_err ("Could not create drop monitor netlink family\n" );
1747
1751
goto out_unreg ;
1748
1752
}
1753
+ WARN_ON (net_drop_monitor_family .mcgrp_offset != NET_DM_GRP_ALERT );
1749
1754
1750
1755
rc = 0 ;
1751
1756
1752
- for_each_possible_cpu (cpu ) {
1753
- net_dm_cpu_data_init (cpu );
1754
- net_dm_hw_cpu_data_init (cpu );
1755
- }
1756
-
1757
1757
goto out ;
1758
1758
1759
1759
out_unreg :
1760
- genl_unregister_family ( & net_drop_monitor_family );
1760
+ WARN_ON ( unregister_netdevice_notifier ( & dropmon_net_notifier ) );
1761
1761
out :
1762
1762
return rc ;
1763
1763
}
@@ -1766,19 +1766,18 @@ static void exit_net_drop_monitor(void)
1766
1766
{
1767
1767
int cpu ;
1768
1768
1769
- BUG_ON (unregister_netdevice_notifier (& dropmon_net_notifier ));
1770
-
1771
1769
/*
1772
1770
* Because of the module_get/put we do in the trace state change path
1773
1771
* we are guaranteed not to have any current users when we get here
1774
1772
*/
1773
+ BUG_ON (genl_unregister_family (& net_drop_monitor_family ));
1774
+
1775
+ BUG_ON (unregister_netdevice_notifier (& dropmon_net_notifier ));
1775
1776
1776
1777
for_each_possible_cpu (cpu ) {
1777
1778
net_dm_hw_cpu_data_fini (cpu );
1778
1779
net_dm_cpu_data_fini (cpu );
1779
1780
}
1780
-
1781
- BUG_ON (genl_unregister_family (& net_drop_monitor_family ));
1782
1781
}
1783
1782
1784
1783
module_init (init_net_drop_monitor );
0 commit comments