Commit 97f80bc6 authored by Jeff Garzik's avatar Jeff Garzik Committed by David S. Miller

[ATM]: handle sysfs errors

Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fd169f15
...@@ -141,7 +141,7 @@ static struct class atm_class = { ...@@ -141,7 +141,7 @@ static struct class atm_class = {
int atm_register_sysfs(struct atm_dev *adev) int atm_register_sysfs(struct atm_dev *adev)
{ {
struct class_device *cdev = &adev->class_dev; struct class_device *cdev = &adev->class_dev;
int i, err; int i, j, err;
cdev->class = &atm_class; cdev->class = &atm_class;
class_set_devdata(cdev, adev); class_set_devdata(cdev, adev);
...@@ -151,10 +151,19 @@ int atm_register_sysfs(struct atm_dev *adev) ...@@ -151,10 +151,19 @@ int atm_register_sysfs(struct atm_dev *adev)
if (err < 0) if (err < 0)
return err; return err;
for (i = 0; atm_attrs[i]; i++) for (i = 0; atm_attrs[i]; i++) {
class_device_create_file(cdev, atm_attrs[i]); err = class_device_create_file(cdev, atm_attrs[i]);
if (err)
goto err_out;
}
return 0; 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) void atm_unregister_sysfs(struct atm_dev *adev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment