aboutsummaryrefslogtreecommitdiffstats
path: root/net/atm/clip.c
diff options
context:
space:
mode:
authorWang Chen <wangchen@cn.fujitsu.com>2008-03-24 00:45:36 -0400
committerDavid S. Miller <davem@davemloft.net>2008-03-24 00:45:36 -0400
commitdbee0d3f4603b9d0e56234a0743321fe4dad31ca (patch)
treed13b829d46ae603b8e7772ecae72e9be1fdfb7af /net/atm/clip.c
parentda990a2402aeaee84837f29054c4628eb02f7493 (diff)
[ATM]: When proc_create() fails, do some error handling work and return -ENOMEM.
Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/atm/clip.c')
-rw-r--r--net/atm/clip.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/net/atm/clip.c b/net/atm/clip.c
index d30167c0b48e..2ab1e36098fd 100644
--- a/net/atm/clip.c
+++ b/net/atm/clip.c
@@ -947,6 +947,8 @@ static const struct file_operations arp_seq_fops = {
947}; 947};
948#endif 948#endif
949 949
950static void atm_clip_exit_noproc(void);
951
950static int __init atm_clip_init(void) 952static int __init atm_clip_init(void)
951{ 953{
952 neigh_table_init_no_netlink(&clip_tbl); 954 neigh_table_init_no_netlink(&clip_tbl);
@@ -963,18 +965,22 @@ static int __init atm_clip_init(void)
963 struct proc_dir_entry *p; 965 struct proc_dir_entry *p;
964 966
965 p = proc_create("arp", S_IRUGO, atm_proc_root, &arp_seq_fops); 967 p = proc_create("arp", S_IRUGO, atm_proc_root, &arp_seq_fops);
968 if (!p) {
969 printk(KERN_ERR "Unable to initialize "
970 "/proc/net/atm/arp\n");
971 atm_clip_exit_noproc();
972 return -ENOMEM;
973 }
966 } 974 }
967#endif 975#endif
968 976
969 return 0; 977 return 0;
970} 978}
971 979
972static void __exit atm_clip_exit(void) 980static void atm_clip_exit_noproc(void)
973{ 981{
974 struct net_device *dev, *next; 982 struct net_device *dev, *next;
975 983
976 remove_proc_entry("arp", atm_proc_root);
977
978 unregister_inetaddr_notifier(&clip_inet_notifier); 984 unregister_inetaddr_notifier(&clip_inet_notifier);
979 unregister_netdevice_notifier(&clip_dev_notifier); 985 unregister_netdevice_notifier(&clip_dev_notifier);
980 986
@@ -1005,6 +1011,13 @@ static void __exit atm_clip_exit(void)
1005 clip_tbl_hook = NULL; 1011 clip_tbl_hook = NULL;
1006} 1012}
1007 1013
1014static void __exit atm_clip_exit(void)
1015{
1016 remove_proc_entry("arp", atm_proc_root);
1017
1018 atm_clip_exit_noproc();
1019}
1020
1008module_init(atm_clip_init); 1021module_init(atm_clip_init);
1009module_exit(atm_clip_exit); 1022module_exit(atm_clip_exit);
1010MODULE_AUTHOR("Werner Almesberger"); 1023MODULE_AUTHOR("Werner Almesberger");