Skip to content

Commit

Permalink
[ATM]: handle sysfs errors
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jeff Garzik authored and David S. Miller committed Oct 22, 2006
1 parent fd169f1 commit 97f80bc
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions net/atm/atm_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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)
Expand Down

0 comments on commit 97f80bc

Please sign in to comment.