diff options
author | Jeff Garzik <jeff@garzik.org> | 2006-10-21 04:48:42 +0200 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-10-22 04:55:22 +0200 |
commit | 97f80bc66f5c6384e3aab70c67340116b8c4284b (patch) | |
tree | bccbb44a0e19cfd9a7419ea53317ad6e03280380 /net/atm/atm_sysfs.c | |
parent | [DCCP] ipv6: Fix opt_skb leak. (diff) | |
download | linux-97f80bc66f5c6384e3aab70c67340116b8c4284b.tar.xz linux-97f80bc66f5c6384e3aab70c67340116b8c4284b.zip |
[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/atm_sysfs.c')
-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 = { int atm_register_sysfs(struct atm_dev *adev) { struct class_device *cdev = &adev->class_dev; - int i, err; + int i, j, err; cdev->class = &atm_class; class_set_devdata(cdev, adev); @@ -151,10 +151,19 @@ int atm_register_sysfs(struct atm_dev *adev) if (err < 0) return err; - for (i = 0; atm_attrs[i]; i++) - class_device_create_file(cdev, atm_attrs[i]); + for (i = 0; atm_attrs[i]; i++) { + err = class_device_create_file(cdev, atm_attrs[i]); + if (err) + goto err_out; + } return 0; + +err_out: + for (j = 0; j < i; j++) + class_device_remove_file(cdev, atm_attrs[j]); + class_device_del(cdev); + return err; } void atm_unregister_sysfs(struct atm_dev *adev) |