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