diff options
Diffstat (limited to 'net/atm/resources.c')
| -rw-r--r-- | net/atm/resources.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/net/atm/resources.c b/net/atm/resources.c index 18ac80698f83..529f7e64aa2c 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> |
| @@ -34,10 +33,9 @@ static struct atm_dev *__alloc_atm_dev(const char *type) | |||
| 34 | { | 33 | { |
| 35 | struct atm_dev *dev; | 34 | struct atm_dev *dev; |
| 36 | 35 | ||
| 37 | dev = kmalloc(sizeof(*dev), GFP_KERNEL); | 36 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
| 38 | if (!dev) | 37 | if (!dev) |
| 39 | return NULL; | 38 | return NULL; |
| 40 | memset(dev, 0, sizeof(*dev)); | ||
| 41 | dev->type = type; | 39 | dev->type = type; |
| 42 | dev->signal = ATM_PHY_SIG_UNKNOWN; | 40 | dev->signal = ATM_PHY_SIG_UNKNOWN; |
| 43 | dev->link_rate = ATM_OC3_PCR; | 41 | dev->link_rate = ATM_OC3_PCR; |
| @@ -114,14 +112,27 @@ struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops, | |||
| 114 | printk(KERN_ERR "atm_dev_register: " | 112 | printk(KERN_ERR "atm_dev_register: " |
| 115 | "atm_proc_dev_register failed for dev %s\n", | 113 | "atm_proc_dev_register failed for dev %s\n", |
| 116 | type); | 114 | type); |
| 117 | mutex_unlock(&atm_dev_mutex); | 115 | goto out_fail; |
| 118 | kfree(dev); | 116 | } |
| 119 | return NULL; | 117 | |
| 118 | if (atm_register_sysfs(dev) < 0) { | ||
| 119 | printk(KERN_ERR "atm_dev_register: " | ||
| 120 | "atm_register_sysfs failed for dev %s\n", | ||
| 121 | type); | ||
| 122 | atm_proc_dev_deregister(dev); | ||
| 123 | goto out_fail; | ||
| 120 | } | 124 | } |
| 125 | |||
| 121 | list_add_tail(&dev->dev_list, &atm_devs); | 126 | list_add_tail(&dev->dev_list, &atm_devs); |
| 122 | mutex_unlock(&atm_dev_mutex); | ||
| 123 | 127 | ||
| 128 | out: | ||
| 129 | mutex_unlock(&atm_dev_mutex); | ||
| 124 | return dev; | 130 | return dev; |
| 131 | |||
| 132 | out_fail: | ||
| 133 | kfree(dev); | ||
| 134 | dev = NULL; | ||
| 135 | goto out; | ||
| 125 | } | 136 | } |
| 126 | 137 | ||
| 127 | 138 | ||
| @@ -140,6 +151,7 @@ void atm_dev_deregister(struct atm_dev *dev) | |||
| 140 | mutex_unlock(&atm_dev_mutex); | 151 | mutex_unlock(&atm_dev_mutex); |
| 141 | 152 | ||
| 142 | atm_dev_release_vccs(dev); | 153 | atm_dev_release_vccs(dev); |
| 154 | atm_unregister_sysfs(dev); | ||
| 143 | atm_proc_dev_deregister(dev); | 155 | atm_proc_dev_deregister(dev); |
| 144 | 156 | ||
| 145 | atm_dev_put(dev); | 157 | atm_dev_put(dev); |
