aboutsummaryrefslogtreecommitdiffstats
path: root/net/atm/resources.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/atm/resources.c')
-rw-r--r--net/atm/resources.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/net/atm/resources.c b/net/atm/resources.c
index 18ac80698f83..de25c6408b04 100644
--- a/net/atm/resources.c
+++ b/net/atm/resources.c
@@ -8,7 +8,6 @@
8 * use the default destruct function initialized by sock_init_data */ 8 * use the default destruct function initialized by sock_init_data */
9 9
10 10
11#include <linux/config.h>
12#include <linux/ctype.h> 11#include <linux/ctype.h>
13#include <linux/string.h> 12#include <linux/string.h>
14#include <linux/atmdev.h> 13#include <linux/atmdev.h>
@@ -114,14 +113,27 @@ struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops,
114 printk(KERN_ERR "atm_dev_register: " 113 printk(KERN_ERR "atm_dev_register: "
115 "atm_proc_dev_register failed for dev %s\n", 114 "atm_proc_dev_register failed for dev %s\n",
116 type); 115 type);
117 mutex_unlock(&atm_dev_mutex); 116 goto out_fail;
118 kfree(dev); 117 }
119 return NULL; 118
119 if (atm_register_sysfs(dev) < 0) {
120 printk(KERN_ERR "atm_dev_register: "
121 "atm_register_sysfs failed for dev %s\n",
122 type);
123 atm_proc_dev_deregister(dev);
124 goto out_fail;
120 } 125 }
126
121 list_add_tail(&dev->dev_list, &atm_devs); 127 list_add_tail(&dev->dev_list, &atm_devs);
122 mutex_unlock(&atm_dev_mutex);
123 128
129out:
130 mutex_unlock(&atm_dev_mutex);
124 return dev; 131 return dev;
132
133out_fail:
134 kfree(dev);
135 dev = NULL;
136 goto out;
125} 137}
126 138
127 139
@@ -140,6 +152,7 @@ void atm_dev_deregister(struct atm_dev *dev)
140 mutex_unlock(&atm_dev_mutex); 152 mutex_unlock(&atm_dev_mutex);
141 153
142 atm_dev_release_vccs(dev); 154 atm_dev_release_vccs(dev);
155 atm_unregister_sysfs(dev);
143 atm_proc_dev_deregister(dev); 156 atm_proc_dev_deregister(dev);
144 157
145 atm_dev_put(dev); 158 atm_dev_put(dev);