diff options
author | Wang Chen <wangchen@cn.fujitsu.com> | 2008-07-03 00:13:36 -0400 |
---|---|---|
committer | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2008-07-03 04:51:57 -0400 |
commit | 03d2f897e9fb3218989baa2139a951ce7f5414bf (patch) | |
tree | 2949bdd7fbe49c3754cdc8140d5b67b37f0edd66 /net/ipv4/ipmr.c | |
parent | 623d1a1af77bd52a389c6eda5920e28eb2ee468b (diff) |
ipv4: Do cleanup for ip_mr_init
Same as ip6_mr_init(), make ip_mr_init() return errno if fails.
But do not do error handling in inet_init(), just print a msg.
Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Diffstat (limited to 'net/ipv4/ipmr.c')
-rw-r--r-- | net/ipv4/ipmr.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 300ab0c2919e..438fab9c62a0 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -1878,16 +1878,36 @@ static struct net_protocol pim_protocol = { | |||
1878 | * Setup for IP multicast routing | 1878 | * Setup for IP multicast routing |
1879 | */ | 1879 | */ |
1880 | 1880 | ||
1881 | void __init ip_mr_init(void) | 1881 | int __init ip_mr_init(void) |
1882 | { | 1882 | { |
1883 | int err; | ||
1884 | |||
1883 | mrt_cachep = kmem_cache_create("ip_mrt_cache", | 1885 | mrt_cachep = kmem_cache_create("ip_mrt_cache", |
1884 | sizeof(struct mfc_cache), | 1886 | sizeof(struct mfc_cache), |
1885 | 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, | 1887 | 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, |
1886 | NULL); | 1888 | NULL); |
1889 | if (!mrt_cachep) | ||
1890 | return -ENOMEM; | ||
1891 | |||
1887 | setup_timer(&ipmr_expire_timer, ipmr_expire_process, 0); | 1892 | setup_timer(&ipmr_expire_timer, ipmr_expire_process, 0); |
1888 | register_netdevice_notifier(&ip_mr_notifier); | 1893 | err = register_netdevice_notifier(&ip_mr_notifier); |
1894 | if (err) | ||
1895 | goto reg_notif_fail; | ||
1889 | #ifdef CONFIG_PROC_FS | 1896 | #ifdef CONFIG_PROC_FS |
1890 | proc_net_fops_create(&init_net, "ip_mr_vif", 0, &ipmr_vif_fops); | 1897 | err = -ENOMEM; |
1891 | proc_net_fops_create(&init_net, "ip_mr_cache", 0, &ipmr_mfc_fops); | 1898 | if (!proc_net_fops_create(&init_net, "ip_mr_vif", 0, &ipmr_vif_fops)) |
1899 | goto proc_vif_fail; | ||
1900 | if (!proc_net_fops_create(&init_net, "ip_mr_cache", 0, &ipmr_mfc_fops)) | ||
1901 | goto proc_cache_fail; | ||
1892 | #endif | 1902 | #endif |
1903 | return 0; | ||
1904 | reg_notif_fail: | ||
1905 | kmem_cache_destroy(mrt_cachep); | ||
1906 | #ifdef CONFIG_PROC_FS | ||
1907 | proc_vif_fail: | ||
1908 | unregister_netdevice_notifier(&ip_mr_notifier); | ||
1909 | proc_cache_fail: | ||
1910 | proc_net_remove(&init_net, "ip_mr_vif"); | ||
1911 | #endif | ||
1912 | return err; | ||
1893 | } | 1913 | } |