diff options
author | Jeff Garzik <jeff@garzik.org> | 2006-10-20 22:48:42 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-10-21 22:55:22 -0400 |
commit | 97f80bc66f5c6384e3aab70c67340116b8c4284b (patch) | |
tree | bccbb44a0e19cfd9a7419ea53317ad6e03280380 /net/atm | |
parent | fd169f15a67b47f23bd1704919c719a8e8409a73 (diff) |
[ATM]: handle sysfs errors
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/atm')
-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 c0a4ae28fcf..62f6ed1f2f9 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) |