diff options
-rw-r--r-- | net/atm/atm_sysfs.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/net/atm/atm_sysfs.c b/net/atm/atm_sysfs.c index c0a4ae28fcfa..62f6ed1f2f98 100644 --- a/net/atm/atm_sysfs.c +++ b/net/atm/atm_sysfs.c | |||
@@ -141,7 +141,7 @@ static struct class atm_class = { | |||
141 | int atm_register_sysfs(struct atm_dev *adev) | 141 | int atm_register_sysfs(struct atm_dev *adev) |
142 | { | 142 | { |
143 | struct class_device *cdev = &adev->class_dev; | 143 | struct class_device *cdev = &adev->class_dev; |
144 | int i, err; | 144 | int i, j, err; |
145 | 145 | ||
146 | cdev->class = &atm_class; | 146 | cdev->class = &atm_class; |
147 | class_set_devdata(cdev, adev); | 147 | class_set_devdata(cdev, adev); |
@@ -151,10 +151,19 @@ int atm_register_sysfs(struct atm_dev *adev) | |||
151 | if (err < 0) | 151 | if (err < 0) |
152 | return err; | 152 | return err; |
153 | 153 | ||
154 | for (i = 0; atm_attrs[i]; i++) | 154 | for (i = 0; atm_attrs[i]; i++) { |
155 | class_device_create_file(cdev, atm_attrs[i]); | 155 | err = class_device_create_file(cdev, atm_attrs[i]); |
156 | if (err) | ||
157 | goto err_out; | ||
158 | } | ||
156 | 159 | ||
157 | return 0; | 160 | return 0; |
161 | |||
162 | err_out: | ||
163 | for (j = 0; j < i; j++) | ||
164 | class_device_remove_file(cdev, atm_attrs[j]); | ||
165 | class_device_del(cdev); | ||
166 | return err; | ||
158 | } | 167 | } |
159 | 168 | ||
160 | void atm_unregister_sysfs(struct atm_dev *adev) | 169 | void atm_unregister_sysfs(struct atm_dev *adev) |