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.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/net/atm/resources.c b/net/atm/resources.c
index 18ac80698f83..534baf704056 100644
--- a/net/atm/resources.c
+++ b/net/atm/resources.c
@@ -114,14 +114,27 @@ struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops,
114 printk(KERN_ERR "atm_dev_register: " 114 printk(KERN_ERR "atm_dev_register: "
115 "atm_proc_dev_register failed for dev %s\n", 115 "atm_proc_dev_register failed for dev %s\n",
116 type); 116 type);
117 mutex_unlock(&atm_dev_mutex); 117 goto out_fail;
118 kfree(dev); 118 }
119 return NULL; 119
120 if (atm_register_sysfs(dev) < 0) {
121 printk(KERN_ERR "atm_dev_register: "
122 "atm_register_sysfs failed for dev %s\n",
123 type);
124 atm_proc_dev_deregister(dev);
125 goto out_fail;
120 } 126 }
127
121 list_add_tail(&dev->dev_list, &atm_devs); 128 list_add_tail(&dev->dev_list, &atm_devs);
122 mutex_unlock(&atm_dev_mutex);
123 129
130out:
131 mutex_unlock(&atm_dev_mutex);
124 return dev; 132 return dev;
133
134out_fail:
135 kfree(dev);
136 dev = NULL;
137 goto out;
125} 138}
126 139
127 140
@@ -140,6 +153,7 @@ void atm_dev_deregister(struct atm_dev *dev)
140 mutex_unlock(&atm_dev_mutex); 153 mutex_unlock(&atm_dev_mutex);
141 154
142 atm_dev_release_vccs(dev); 155 atm_dev_release_vccs(dev);
156 atm_unregister_sysfs(dev);
143 atm_proc_dev_deregister(dev); 157 atm_proc_dev_deregister(dev);
144 158
145 atm_dev_put(dev); 159 atm_dev_put(dev);