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